Skip to content

Commit

Permalink
small check on the data type
Browse files Browse the repository at this point in the history
  • Loading branch information
perdigao1 committed Oct 25, 2023
1 parent a505048 commit be36b40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/napari_h5/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
DataType = Union[Any, Sequence[Any]]
FullLayerData = Tuple[DataType, dict, str]

#https://napari.org/dev/plugins/guides.html?highlight=napari_get_writer

#https://napari.org/stable/plugins/guides.html#single-layer-writer
def single_layer_writer(path: str, data: Any, attributes: dict) -> List[str]:
"""Writes a single image layer"""

if not isinstance(data, np.ndarray):
raise ValueError("data is not ndarray. Not saving.")

with h5py.File(path,'w') as f:
f.create_dataset('data', data=data)

Expand Down

0 comments on commit be36b40

Please sign in to comment.