Ejemplo n.º 1
0
 def __setstate__(self, data: JsonValue):
     data_obj = ensureJsonObject(data)
     self.__init__(
         path=Path(ensureJsonString(data_obj.get("path"))),
         location=Interval5D.from_json_value(data_obj.get("interval")).start,
         filesystem=JsonableFilesystem.from_json_value(data_obj.get("filesystem"))
     )
Ejemplo n.º 2
0
 def from_json_value(cls, value: JsonValue) -> "N5DataSource":
     value_obj = ensureJsonObject(value)
     raw_location = value_obj.get("location")
     return N5DataSource(
         path=Path(ensureJsonString(value_obj.get("path"))),
         filesystem=JsonableFilesystem.from_json_value(value_obj.get("filesystem")),
         location=raw_location if raw_location is None else Point5D.from_json_value(raw_location),
     )
Ejemplo n.º 3
0
 def __setstate__(self, value_obj: JsonObject):
     self.__init__(
         path=PurePosixPath(ensureJsonString(value_obj.get("path"))),
         location=ensureOptional(Point5D.from_json_value, value_obj.get("location")) or Point5D.zero(),
         filesystem=JsonableFilesystem.from_json_value(value_obj.get("filesystem")),
         tile_shape=ensureOptional(Shape5D.from_json_value, value_obj.get("tile_shape")),
         spatial_resolution=ensureOptional(ensureJsonIntTripplet, value_obj.get("spatial_resolution")),
     )
Ejemplo n.º 4
0
 def from_json_value(cls, value: JsonValue) -> "SkimageDataSource":
     value_obj = ensureJsonObject(value)
     return SkimageDataSource(
         path=PurePosixPath(ensureJsonString(value_obj.get("path"))),
         location=ensureOptional(Point5D.from_json_value, value_obj.get("location")) or Point5D.zero(),
         filesystem=JsonableFilesystem.from_json_value(value_obj.get("filesystem")),
         tile_shape=ensureOptional(Shape5D.from_json_value, value_obj.get("tile_shape")),
         spatial_resolution=ensureOptional(ensureJsonIntTripplet, value_obj.get("spatial_resolution")),
     )
Ejemplo n.º 5
0
 def from_json_value(cls, value: JsonValue) -> "PrecomputedChunksScaleSink":
     value_obj = ensureJsonObject(value)
     return PrecomputedChunksScaleSink(
         filesystem=JsonableFilesystem.from_json_value(
             value_obj.get("filesystem")),
         info_dir=PurePosixPath(ensureJsonString(
             value_obj.get("info_dir"))),
         scale=PrecomputedChunksScale.from_json_value(
             value_obj.get("scale")),
         dtype=np.dtype(ensureJsonString(value_obj.get("dtype"))),
         num_channels=ensureJsonInt(value_obj.get("num_channels")))
Ejemplo n.º 6
0
 def from_json_value(cls, value: JsonValue) -> "PrecomputedChunksScaleSink":
     value_obj = ensureJsonObject(value)
     return PrecomputedChunksScaleSink(
         filesystem=JsonableFilesystem.from_json_value(
             value_obj.get("filesystem")),
         base_path=Path(ensureJsonString(value_obj.get("base_path"))),
         scale=PrecomputedChunksScale5D.from_json_value(
             value_obj.get("scale")),
         dtype=np.dtype(ensureJsonString(
             value_obj.get("dtype"))),  #type: ignore
     )
Ejemplo n.º 7
0
 def from_json_value(cls, value: JsonValue) -> "SkimageDataSource":
     value_obj = ensureJsonObject(value)
     raw_location = value_obj.get("location")
     raw_tile_shape = value_obj.get("tile_shape")
     return SkimageDataSource(
         path=Path(ensureJsonString(value_obj.get("path"))),
         location=Point5D.zero()
         if raw_location is None else Point5D.from_json_value(raw_location),
         filesystem=JsonableFilesystem.from_json_value(
             value_obj.get("filesystem")),
         tile_shape=None if raw_tile_shape is None else
         Shape5D.from_json_value(raw_tile_shape))
Ejemplo n.º 8
0
 def from_json_value(cls, value: JsonValue) -> "H5DataSource":
     value_obj = ensureJsonObject(value)
     raw_location = value_obj.get("location")
     return H5DataSource(
         outer_path=Path(ensureJsonString(value_obj.get("outer_path"))),
         inner_path=PurePosixPath(
             ensureJsonString(value_obj.get("inner_path"))),
         filesystem=JsonableFilesystem.from_json_value(
             value_obj.get("filesystem")),
         location=Point5D.zero()
         if raw_location is None else Point5D.from_json_value(raw_location),
     )
Ejemplo n.º 9
0
 def from_json_value(cls, value: JsonValue) -> "H5DataSource":
     value_obj = ensureJsonObject(value)
     return H5DataSource(outer_path=PurePosixPath(
         ensureJsonString(value_obj.get("outer_path"))),
                         inner_path=PurePosixPath(
                             ensureJsonString(value_obj.get("inner_path"))),
                         filesystem=JsonableFilesystem.from_json_value(
                             value_obj.get("filesystem")),
                         location=ensureOptional(Point5D.from_json_value,
                                                 value_obj.get("location"))
                         or Point5D.zero(),
                         spatial_resolution=ensureJsonIntTripplet(
                             value_obj.get("spatial_resolution")))
Ejemplo n.º 10
0
 def from_json_value(cls,
                     value: JsonValue) -> "PrecomputedChunksDataSource":
     value_obj = ensureJsonObject(value)
     raw_location = value_obj.get("location")
     raw_chunk_size = value_obj.get("chunk_size")
     return PrecomputedChunksDataSource(
         path=Path(ensureJsonString(value_obj.get("path"))),
         resolution=ensureJsonIntTripplet(
             value_obj.get("spatial_resolution")
         ),  # FIXME? change to just resolution?
         location=None
         if raw_location is None else Point5D.from_json_value(raw_location),
         chunk_size=None if raw_chunk_size is None else
         Shape5D.from_json_value(raw_chunk_size),
         filesystem=JsonableFilesystem.from_json_value(
             value_obj.get("filesystem")),
     )