Interface LabelingIOService

    • Method Detail

      • 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 value
        I - IntegerType for the pixel value
        S - Class of the meta data
        Parameters:
        file - The path to the file
        metadataType - 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 value
        I - IntegerType for the pixel value
        S - Class of the meta data
        Parameters:
        file - The path to the file
        idToLabel - a function transforming the label of type T into something else
        metadataClazz - 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 value
        I - IntegerType for the pixel value
        S - Class of the meta data
        Parameters:
        imgLabeling - the imglabeling object that needs to be serialized
        file - 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 value
        I - IntegerType for the pixel value
        S - Class of the meta data
        Parameters:
        imgLabeling - the imglabeling object that needs to be serialized
        labelToId - a function to convert the type T to a long value.
        file - the path pointing to the file, including the filename
        Throws:
        IOException