Interface JHDFService

All Superinterfaces:
loci.common.services.Service
All Known Implementing Classes:
JHDFServiceImpl

public interface JHDFService extends loci.common.services.Service
Utility class for working with NetCDF/HDF files.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes and resets the service.
    void
    Writes an array as sub-slice into an existing HDF5 dataset
    boolean
    exists(String path)
    Checks if path in HDF5 file exists.
    int
    Retrieves the Element Size of a dataset in Byte.
    Retrieves the current initialized file path.
    Retrieves the all members of a group.
    int[]
    Retrieves the shape of a dataset.
    void
    initIntArray(String path, long[] dimensions, long bpp)
    Creates an HDF5 dataset in path consisting of integers specified by bytes per pixel bpp.
    ch.systemsx.cisd.base.mdarray.MDByteArray
    Reads a multi-dimensional byte array from path.
    ch.systemsx.cisd.base.mdarray.MDByteArray
    readByteBlockArray(String path, int[] offset, int[] size)
    Reads a multi-dimensional sub-block byte array from path.
    ch.systemsx.cisd.hdf5.HDF5CompoundDataMap[]
    Reads Compound array of any type
    ch.systemsx.cisd.base.mdarray.MDIntArray
    Reads a multi-dimensional int array from path.
    ch.systemsx.cisd.base.mdarray.MDIntArray
    readIntBlockArray(String path, int[] offset, int[] size)
    Reads a multi-dimensional sub-block int array from path.
    ch.systemsx.cisd.base.mdarray.MDShortArray
    readShortBlockArray(String path, int[] offset, int[] size)
    Reads a multi-dimensional sub-block short array from path.
    Reads String array array from path.
    void
    Initializes the service on a given file path.
    void
    Initializes the service on a given file path.
    void
    writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDByteArray image, long[] offset)
    Writes an array as sub-slice into an existing HDF5 dataset
    void
    writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDIntArray image, long[] offset)
    Writes an array as sub-slice into an existing HDF5 dataset
    void
    writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDShortArray image, long[] offset)
    Writes an array as sub-slice into an existing HDF5 dataset
  • Method Details

    • setFile

      void setFile(String file) throws IOException
      Initializes the service on a given file path.
      Parameters:
      file - Path to initialize the service with.
      Throws:
      IOException - If there is an error initializing the service with file.
    • setFileForWrite

      void setFileForWrite(String file) throws IOException
      Initializes the service on a given file path.
      Parameters:
      file - Path to initialize the service with.
      Throws:
      IOException - If there is an error initializing the service with file.
    • getFile

      String getFile()
      Retrieves the current initialized file path.
      Returns:
      Current initialized file path or null if the service has yet to be initialized or is closed.
    • getShape

      int[] getShape(String path)
      Retrieves the shape of a dataset.
      Parameters:
      path - HDF path to the dataset.
      Returns:
      int[] of shapes.
    • getMember

      List<String> getMember(String path)
      Retrieves the all members of a group.
      Parameters:
      path - HDF path to the group.
      Returns:
      List of members.
    • getElementSize

      int getElementSize(String path)
      Retrieves the Element Size of a dataset in Byte.
      Parameters:
      path - HDF path to the group.
      Returns:
      List of members.
    • readByteArray

      ch.systemsx.cisd.base.mdarray.MDByteArray readByteArray(String path)
      Reads a multi-dimensional byte array from path.
      Parameters:
      path - HDF path to the dataset.
      Returns:
      MDByteArray array of bytes.
    • readIntArray

      ch.systemsx.cisd.base.mdarray.MDIntArray readIntArray(String path)
      Reads a multi-dimensional int array from path.
      Parameters:
      path - HDF path to the dataset.
      Returns:
      MDIntArray array of int.
    • readIntBlockArray

      ch.systemsx.cisd.base.mdarray.MDIntArray readIntBlockArray(String path, int[] offset, int[] size)
      Reads a multi-dimensional sub-block int array from path.
      Parameters:
      path - HDF path to the dataset.
      offset - Offset of the block to read.
      size - Output size of the array.
      Returns:
      MDIntArray array of int.
    • readByteBlockArray

      ch.systemsx.cisd.base.mdarray.MDByteArray readByteBlockArray(String path, int[] offset, int[] size)
      Reads a multi-dimensional sub-block byte array from path.
      Parameters:
      path - HDF path to the dataset.
      offset - Offset of the block to read.
      size - Output size of the array.
      Returns:
      MDIntArray array of int.
    • readShortBlockArray

      ch.systemsx.cisd.base.mdarray.MDShortArray readShortBlockArray(String path, int[] offset, int[] size)
      Reads a multi-dimensional sub-block short array from path.
      Parameters:
      path - HDF path to the dataset.
      offset - Offset of the block to read.
      size - Output size of the array.
      Returns:
      MDIntArray array of int.
    • readStringArray

      String[] readStringArray(String path)
      Reads String array array from path.
      Parameters:
      path - HDF path to the dataset.
      Returns:
      String[] array.
    • readCompoundArrayDataMap

      ch.systemsx.cisd.hdf5.HDF5CompoundDataMap[] readCompoundArrayDataMap(String path)
      Reads Compound array of any type
      Parameters:
      path - HDF path to the dataset.
      Returns:
      HDF5CompoundDataMap[] compound array map.
    • exists

      boolean exists(String path)
      Checks if path in HDF5 file exists.
      Parameters:
      path - path to HDF5 group or dataset.
      Returns:
      boolean true if path exists in HDF5 file else false.
    • initIntArray

      void initIntArray(String path, long[] dimensions, long bpp)
      Creates an HDF5 dataset in path consisting of integers specified by bytes per pixel bpp.
      Parameters:
      path - path to HDF5 a dataset.
      bpp - bytes per pixel for the integer data type bpp \in {1,2,4} == {Byte, Short, Integer}
    • writeArraySlice

      void writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDByteArray image, long[] offset)
      Writes an array as sub-slice into an existing HDF5 dataset
      Parameters:
      path - path to the (existing) HDF5 dataset.
      image - the data stored as MDArray of pixel type Byte
      offset - dimensions, where to start writing the image. The image will be written from offset to offset + image.dimensions()
    • writeArraySlice

      void writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDShortArray image, long[] offset)
      Writes an array as sub-slice into an existing HDF5 dataset
      Parameters:
      path - path to the (existing) HDF5 dataset.
      image - the data stored as MDArray of pixel type Short
      offset - dimensions, where to start writing the image. The image will be written from offset to offset + image.dimensions()
    • writeArraySlice

      void writeArraySlice(String path, ch.systemsx.cisd.base.mdarray.MDIntArray image, long[] offset)
      Writes an array as sub-slice into an existing HDF5 dataset
      Parameters:
      path - path to the (existing) HDF5 dataset.
      image - the data stored as MDArray of pixel type int
      offset - dimensions, where to start writing the image. The image will be written from offset to offset + image.dimensions()
    • createGroup

      void createGroup(String path) throws IOException
      Writes an array as sub-slice into an existing HDF5 dataset
      Parameters:
      path - path of the HDF5 group.
      Throws:
      IOException
    • close

      void close() throws IOException
      Closes and resets the service.
      Throws:
      IOException - If there is an error closing the file.