fctpd 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fctpd-0.2.2/src/fctpd.egg-info → fctpd-0.2.3}/PKG-INFO +1 -1
- {fctpd-0.2.2 → fctpd-0.2.3}/pyproject.toml +1 -1
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fpb_writer.py +2 -2
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fph_writer.py +2 -2
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/marshaler.py +21 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/projection.py +2 -4
- {fctpd-0.2.2 → fctpd-0.2.3/src/fctpd.egg-info}/PKG-INFO +1 -1
- {fctpd-0.2.2 → fctpd-0.2.3}/LICENSE +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/README.md +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/setup.cfg +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/setup.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/__init__.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/enums.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fetcher.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/field_map.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fields.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fpb_reader.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/fph_reader.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/header.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/reader.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/timing.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/uid.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/unmarshaler.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd/writer.py +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd.egg-info/SOURCES.txt +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd.egg-info/dependency_links.txt +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd.egg-info/requires.txt +0 -0
- {fctpd-0.2.2 → fctpd-0.2.3}/src/fctpd.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fctpd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Tools for FPH/FPB, CT projection data formats for the modern compute environment.
|
|
5
5
|
Author-email: "J. Genender, J. Hoffman" <johnmarianhoffman@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.com/hoffman-lab/fct/fpb-py
|
|
@@ -8,7 +8,7 @@ description = "Tools for FPH/FPB, CT projection data formats for the modern comp
|
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "J. Genender, J. Hoffman", email = "johnmarianhoffman@gmail.com" }
|
|
10
10
|
]
|
|
11
|
-
version = "0.2.
|
|
11
|
+
version = "0.2.3"
|
|
12
12
|
requires-python = ">= 3.9"
|
|
13
13
|
readme = "README.md"
|
|
14
14
|
classifiers = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from . import fields
|
|
2
2
|
from .field_map import FieldMap
|
|
3
3
|
from .header import Header
|
|
4
|
-
from .marshaler import ProjectionMarshaler
|
|
4
|
+
from .marshaler import ProjectionMarshaler, _ProjectionEncoder
|
|
5
5
|
from .projection import Projection
|
|
6
6
|
from .timing import nanosecond
|
|
7
7
|
from .writer import WriteOptions, Writer
|
|
@@ -140,7 +140,7 @@ class FPBWriter(Writer):
|
|
|
140
140
|
self._filePtr.seek(self._footerOffset, os.SEEK_SET)
|
|
141
141
|
|
|
142
142
|
# Write the header
|
|
143
|
-
hdr_json: str = dumps(self._header.__dict__)
|
|
143
|
+
hdr_json: str = dumps(self._header.__dict__, cls=_ProjectionEncoder)
|
|
144
144
|
self._filePtr.write(hdr_json.encode())
|
|
145
145
|
|
|
146
146
|
# Write the pixel/count data offset
|
|
@@ -2,7 +2,7 @@ from . import fields
|
|
|
2
2
|
from .enums import WriteMode
|
|
3
3
|
from .field_map import FieldMap
|
|
4
4
|
from .header import Header
|
|
5
|
-
from .marshaler import ProjectionMarshaler
|
|
5
|
+
from .marshaler import ProjectionMarshaler, _ProjectionEncoder
|
|
6
6
|
from .projection import Projection
|
|
7
7
|
from .timing import nanosecond
|
|
8
8
|
from .writer import WriteOptions, Writer
|
|
@@ -165,7 +165,7 @@ class FPHWriter(Writer):
|
|
|
165
165
|
"""
|
|
166
166
|
Flushes the Header to disk and ends the write instance.
|
|
167
167
|
"""
|
|
168
|
-
hdr_json: str = dumps(self._header.__dict__, indent=4)
|
|
168
|
+
hdr_json: str = dumps(self._header.__dict__, indent=4, cls=_ProjectionEncoder)
|
|
169
169
|
self._filePtr.write(hdr_json.encode())
|
|
170
170
|
|
|
171
171
|
if self.options.writeMode == WriteMode.Single:
|
|
@@ -2,11 +2,31 @@ from . import fields
|
|
|
2
2
|
from .enums import PixelEncoding
|
|
3
3
|
from .field_map import FieldMap
|
|
4
4
|
from .projection import Projection, _MAX_UINT16
|
|
5
|
+
from json import JSONEncoder
|
|
5
6
|
from numpy import number
|
|
6
7
|
from numpy.typing import NDArray
|
|
7
8
|
from sys import byteorder
|
|
8
9
|
import numpy as np
|
|
9
10
|
|
|
11
|
+
class _ProjectionEncoder(JSONEncoder):
|
|
12
|
+
"""
|
|
13
|
+
_ProjectionEncoder is an internal class that extends
|
|
14
|
+
JSONEncoder to numpy type support.
|
|
15
|
+
"""
|
|
16
|
+
def default(self, o):
|
|
17
|
+
"""
|
|
18
|
+
Returns a JSON-serializable object for ``o``, or calls
|
|
19
|
+
the base implementation (to raise a ``TypeError``).
|
|
20
|
+
"""
|
|
21
|
+
if isinstance(o, np.floating):
|
|
22
|
+
return float(o)
|
|
23
|
+
elif isinstance(o, np.integer):
|
|
24
|
+
return int(o)
|
|
25
|
+
elif isinstance(o, np.ndarray):
|
|
26
|
+
return o.tolist()
|
|
27
|
+
else:
|
|
28
|
+
return super().default(o)
|
|
29
|
+
|
|
10
30
|
|
|
11
31
|
class ProjectionMarshaler:
|
|
12
32
|
"""
|
|
@@ -84,6 +104,7 @@ class ProjectionMarshaler:
|
|
|
84
104
|
fmap[k] = v
|
|
85
105
|
|
|
86
106
|
# Encode the view. Views must be non-empty.
|
|
107
|
+
print(fmap)
|
|
87
108
|
fmap[fields.View] = {
|
|
88
109
|
fields.TubeAngle: fmap.pop(fields.TubeAngle),
|
|
89
110
|
}
|
|
@@ -205,10 +205,8 @@ def projections_from_array(
|
|
|
205
205
|
fields.MinimumPixelValue: min_px,
|
|
206
206
|
fields.RescaleSlope: rescale_slope,
|
|
207
207
|
fields.RescaleIntercept: rescale_intercept,
|
|
208
|
-
fields.
|
|
209
|
-
|
|
210
|
-
fields.TubeAngle: tube_angles[proj_idx],
|
|
211
|
-
},
|
|
208
|
+
fields.TablePosition: zs[proj_idx],
|
|
209
|
+
fields.TubeAngle: tube_angles[proj_idx],
|
|
212
210
|
}
|
|
213
211
|
)
|
|
214
212
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fctpd
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Tools for FPH/FPB, CT projection data formats for the modern compute environment.
|
|
5
5
|
Author-email: "J. Genender, J. Hoffman" <johnmarianhoffman@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.com/hoffman-lab/fct/fpb-py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|