-
- All Superinterfaces:
Comparable<org.scijava.Prioritized>,org.scijava.Contextual,org.scijava.Disposable,org.scijava.plugin.HasPluginInfo,org.scijava.Identifiable,net.imagej.ImageJService,org.scijava.Initializable,org.scijava.Locatable,org.scijava.log.Logged,org.scijava.Prioritized,org.scijava.plugin.RichPlugin,org.scijava.plugin.SciJavaPlugin,org.scijava.service.Service,org.scijava.Versioned
- All Known Implementing Classes:
DefaultLabelingIOService
public interface LabelingIOService extends net.imagej.ImageJService
A service to easily access a load/save functionality for JSON-based labeling data files. Basic support for primitive types and JSON standard types is already included. For non-primitive types, a codec must be set and the class must be given as an argument to the methods.- Author:
- Tom Burke
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T,I extends net.imglib2.type.numeric.IntegerType<I>>
net.imglib2.roi.labeling.ImgLabeling<T,I>load(String file, Class<T> labelType, Class<I> backingType)<S,T,I extends net.imglib2.type.numeric.IntegerType<I>>
Container<S,T,I>loadWithMetadata(String file, Class<S> metadataType, Class<T> labelType, Class<I> backingType)Load a labeling container from the given file path as string.<S,T,I extends net.imglib2.type.numeric.IntegerType<I>>
Container<S,T,I>loadWithMetadata(String file, LongFunction<T> idToLabel, Class<S> metadataClazz)Load a labeling container from the given file path as string.<T,I extends net.imglib2.type.numeric.IntegerType<I>>
voidsave(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file)<S,T,I extends net.imglib2.type.numeric.IntegerType<I>>
voidsaveWithMetaData(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file, ToLongFunction<T> labelToId, S metadata)Save an ImgLabelingContainer in the file-path, transforming it into a JSON file and an image.<S,T,I extends net.imglib2.type.numeric.IntegerType<I>>
voidsaveWithMetaData(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file, S metadata)Save an ImgLabelingContainer in the file-path, transforming it into a JSON file and an image.-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
load
<T,I extends net.imglib2.type.numeric.IntegerType<I>> net.imglib2.roi.labeling.ImgLabeling<T,I> load(String file, Class<T> labelType, Class<I> backingType) throws IOException
- Throws:
IOException
-
save
<T,I extends net.imglib2.type.numeric.IntegerType<I>> void save(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file) throws IOException
- Throws:
IOException
-
loadWithMetadata
<S,T,I extends net.imglib2.type.numeric.IntegerType<I>> Container<S,T,I> loadWithMetadata(String file, Class<S> metadataType, Class<T> labelType, Class<I> backingType) throws IOException
Load a labeling container from the given file path as string. The file path must point to the JSON file containing the labeling data.- Type Parameters:
T- the label valueI- IntegerType for the pixel valueS- Class of the meta data- Parameters:
file- The path to the filemetadataType- the metadata class- Returns:
- a container object holding the ImgLabeling (as well as an optional source mapping)
- Throws:
IOException- on file read fail
-
loadWithMetadata
<S,T,I extends net.imglib2.type.numeric.IntegerType<I>> Container<S,T,I> loadWithMetadata(String file, LongFunction<T> idToLabel, Class<S> metadataClazz) throws IOException
Load a labeling container from the given file path as string. The file path must point to the JSON file containing the labeling data.- Type Parameters:
T- the label valueI- IntegerType for the pixel valueS- Class of the meta data- Parameters:
file- The path to the fileidToLabel- a function transforming the label of type T into something elsemetadataClazz- the metadata class- Returns:
- a container object holding the ImgLabeling (as well as an optional source mapping)
- Throws:
IOException- on file read fail
-
saveWithMetaData
<S,T,I extends net.imglib2.type.numeric.IntegerType<I>> void saveWithMetaData(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file, S metadata) throws IOException
Save an ImgLabelingContainer in the file-path, transforming it into a JSON file and an image. The path must contain the filename (ending does not matter).- Type Parameters:
T- the label valueI- IntegerType for the pixel valueS- Class of the meta data- Parameters:
imgLabeling- the imglabeling object that needs to be serializedfile- the path pointing to the file, including the filename- Throws:
IOException
-
saveWithMetaData
<S,T,I extends net.imglib2.type.numeric.IntegerType<I>> void saveWithMetaData(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file, ToLongFunction<T> labelToId, S metadata) throws IOException
Save an ImgLabelingContainer in the file-path, transforming it into a JSON file and an image. The path must contain the filename (ending does not matter).- Type Parameters:
T- the label valueI- IntegerType for the pixel valueS- Class of the meta data- Parameters:
imgLabeling- the imglabeling object that needs to be serializedlabelToId- a function to convert the type T to a long value.file- the path pointing to the file, including the filename- Throws:
IOException
-
-