- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- io.scif.labeling.DefaultLabelingIOService
-
- All Implemented Interfaces:
LabelingIOService,Comparable<org.scijava.Prioritized>,net.imagej.ImageJService,org.scijava.Contextual,org.scijava.Disposable,org.scijava.Identifiable,org.scijava.Initializable,org.scijava.Locatable,org.scijava.log.Logged,org.scijava.plugin.HasPluginInfo,org.scijava.plugin.RichPlugin,org.scijava.plugin.SciJavaPlugin,org.scijava.Prioritized,org.scijava.service.Service,org.scijava.Versioned
public class DefaultLabelingIOService extends org.scijava.service.AbstractService implements LabelingIOService
-
-
Constructor Summary
Constructors Constructor Description DefaultLabelingIOService()
-
Method Summary
All Methods Instance Methods Concrete 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 class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority
-
Methods inherited from class org.scijava.AbstractContextual
context
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
public <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
- Specified by:
loadin interfaceLabelingIOService- Throws:
IOException
-
loadWithMetadata
public <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
Description copied from interface:LabelingIOServiceLoad a labeling container from the given file path as string. The file path must point to the JSON file containing the labeling data.- Specified by:
loadWithMetadatain interfaceLabelingIOService- Type Parameters:
S- Class of the meta dataT- the label valueI- IntegerType for the pixel value- 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
public <S,T,I extends net.imglib2.type.numeric.IntegerType<I>> Container<S,T,I> loadWithMetadata(String file, LongFunction<T> idToLabel, Class<S> metadataClazz)
Description copied from interface:LabelingIOServiceLoad a labeling container from the given file path as string. The file path must point to the JSON file containing the labeling data.- Specified by:
loadWithMetadatain interfaceLabelingIOService- Type Parameters:
S- Class of the meta dataT- the label valueI- IntegerType for the pixel value- 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)
-
save
public <T,I extends net.imglib2.type.numeric.IntegerType<I>> void save(net.imglib2.roi.labeling.ImgLabeling<T,I> imgLabeling, String file) throws IOException
- Specified by:
savein interfaceLabelingIOService- Throws:
IOException
-
saveWithMetaData
public <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
Description copied from interface:LabelingIOServiceSave 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).- Specified by:
saveWithMetaDatain interfaceLabelingIOService- Type Parameters:
S- Class of the meta dataT- the label valueI- IntegerType for the pixel value- Parameters:
imgLabeling- the imglabeling object that needs to be serializedfile- the path pointing to the file, including the filename- Throws:
IOException
-
saveWithMetaData
public <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
Description copied from interface:LabelingIOServiceSave 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).- Specified by:
saveWithMetaDatain interfaceLabelingIOService- Type Parameters:
S- Class of the meta dataT- the label valueI- IntegerType for the pixel value- Parameters:
imgLabeling- the imglabeling object that needs to be serializedfile- the path pointing to the file, including the filenamelabelToId- a function to convert the type T to a long value.- Throws:
IOException
-
-