Package loci.formats

Class DimensionSwapper

java.lang.Object
loci.formats.ReaderWrapper
loci.formats.DimensionSwapper
All Implemented Interfaces:
Closeable, AutoCloseable, loci.formats.ICompressedTileReader, loci.formats.IFormatHandler, loci.formats.IFormatReader, loci.formats.IMetadataConfigurable, loci.formats.IPyramidHandler

public class DimensionSwapper extends loci.formats.ReaderWrapper
Handles swapping the dimension order of an image series. This class is useful for both reassigning ZCT sizes (the input dimension order), and shuffling around the resultant planar order (the output dimension order).
  • Field Summary

    Fields inherited from class loci.formats.ReaderWrapper

    reader

    Fields inherited from interface loci.formats.IFormatReader

    CAN_GROUP, CANNOT_GROUP, MUST_GROUP
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a DimensionSwapper around a new image reader.
    DimensionSwapper(loci.formats.IFormatReader r)
    Constructs a DimensionSwapper with the given reader.
  • Method Summary

    Modifier and Type
    Method
    Description
    List<loci.formats.CoreMetadata>
     
     
    int
    getIndex(int z, int c, int t)
     
    int
    getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT)
     
     
    int
     
    int
     
    int
     
    int
     
    int
     
    loci.formats.codec.Codec
    getTileCodec(int no)
     
    loci.formats.codec.CodecOptions
    getTileCodecOptions(int no, int x, int y)
     
    int[]
    getZCTCoords(int no)
     
    int[]
    getZCTModuloCoords(int index)
     
    makeDimensionSwapper(loci.formats.IFormatReader r)
    Converts the given reader into a DimensionSwapper, wrapping if needed.
    byte[]
    openBytes(int no)
     
    byte[]
    openBytes(int no, byte[] buf)
     
    byte[]
    openBytes(int no, byte[] buf, int x, int y, int w, int h)
     
    byte[]
    openBytes(int no, int x, int y, int w, int h)
     
    byte[]
    openCompressedBytes(int no, byte[] buf, int x, int y)
     
    byte[]
    openCompressedBytes(int no, int x, int y)
     
    byte[]
     
    protected int
    reorder(int no)
     
    void
     
    void
    setOutputOrder(String outputOrder)
    Sets the output dimension order according to the given string (e.g., "XYZCT").
    void
    Sets the input dimension order according to the given string (e.g., "XYZCT").

    Methods inherited from class loci.formats.ReaderWrapper

    close, close, coreIndexToSeries, duplicate, fileGroupOption, get16BitLookupTable, get8BitLookupTable, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getBitsPerPixel, getCoreIndex, getCurrentFile, getDatasetStructureDescription, getDomains, getEffectiveSizeC, getFillColor, getFormat, getGlobalMetadata, getImageCount, getMetadataOptions, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getModuloC, getModuloT, getModuloZ, getNativeDataType, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPossibleDomains, getReader, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getSeries, getSeriesCount, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSuffixes, getSupportedMetadataLevels, getThumbSizeX, getThumbSizeY, getTileBoundingBox, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, openPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setMetadataFiltered, setMetadataOptions, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, unwrap, unwrap, unwrap

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DimensionSwapper

      public DimensionSwapper()
      Constructs a DimensionSwapper around a new image reader.
    • DimensionSwapper

      public DimensionSwapper(loci.formats.IFormatReader r)
      Constructs a DimensionSwapper with the given reader.
  • Method Details

    • makeDimensionSwapper

      public static DimensionSwapper makeDimensionSwapper(loci.formats.IFormatReader r)
      Converts the given reader into a DimensionSwapper, wrapping if needed.
    • swapDimensions

      public void swapDimensions(String order)
      Sets the input dimension order according to the given string (e.g., "XYZCT"). This string indicates the planar rasterization order from the source, overriding the detected order. It may result in the dimensional axis sizes changing. If the given order is identical to the file's native order, then nothing happens. Note that this method will throw an exception if X and Y do not appear in positions 0 and 1 (although X and Y can be reversed).
    • setOutputOrder

      public void setOutputOrder(String outputOrder)
      Sets the output dimension order according to the given string (e.g., "XYZCT"). This string indicates the final planar rasterization order—i.e., the mapping from 1D plane number to 3D (Z, C, T) tuple. Changing it will not affect the Z, C or T sizes but will alter the order in which planes are returned when iterating. This method is useful when your application requires a particular output dimension order; e.g., ImageJ virtual stacks must be in XYCZT order.
    • getInputOrder

      public String getInputOrder()
    • getSizeX

      public int getSizeX()
      Specified by:
      getSizeX in interface loci.formats.IFormatReader
      Overrides:
      getSizeX in class loci.formats.ReaderWrapper
    • getSizeY

      public int getSizeY()
      Specified by:
      getSizeY in interface loci.formats.IFormatReader
      Overrides:
      getSizeY in class loci.formats.ReaderWrapper
    • getSizeZ

      public int getSizeZ()
      Specified by:
      getSizeZ in interface loci.formats.IFormatReader
      Overrides:
      getSizeZ in class loci.formats.ReaderWrapper
    • getSizeC

      public int getSizeC()
      Specified by:
      getSizeC in interface loci.formats.IFormatReader
      Overrides:
      getSizeC in class loci.formats.ReaderWrapper
    • getSizeT

      public int getSizeT()
      Specified by:
      getSizeT in interface loci.formats.IFormatReader
      Overrides:
      getSizeT in class loci.formats.ReaderWrapper
    • getDimensionOrder

      public String getDimensionOrder()
      Specified by:
      getDimensionOrder in interface loci.formats.IFormatReader
      Overrides:
      getDimensionOrder in class loci.formats.ReaderWrapper
    • openBytes

      public byte[] openBytes(int no) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, int x, int y, int w, int h) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openBytes

      public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws loci.formats.FormatException, IOException
      Specified by:
      openBytes in interface loci.formats.IFormatReader
      Overrides:
      openBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openThumbBytes

      public byte[] openThumbBytes(int no) throws loci.formats.FormatException, IOException
      Specified by:
      openThumbBytes in interface loci.formats.IFormatReader
      Overrides:
      openThumbBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getZCTCoords

      public int[] getZCTCoords(int no)
      Specified by:
      getZCTCoords in interface loci.formats.IFormatReader
      Overrides:
      getZCTCoords in class loci.formats.ReaderWrapper
    • getZCTModuloCoords

      public int[] getZCTModuloCoords(int index)
      Specified by:
      getZCTModuloCoords in interface loci.formats.IFormatReader
      Overrides:
      getZCTModuloCoords in class loci.formats.ReaderWrapper
    • getIndex

      public int getIndex(int z, int c, int t)
      Specified by:
      getIndex in interface loci.formats.IFormatReader
      Overrides:
      getIndex in class loci.formats.ReaderWrapper
    • getIndex

      public int getIndex(int z, int c, int t, int moduloZ, int moduloC, int moduloT)
      Specified by:
      getIndex in interface loci.formats.IFormatReader
      Overrides:
      getIndex in class loci.formats.ReaderWrapper
    • getCoreMetadataList

      public List<loci.formats.CoreMetadata> getCoreMetadataList()
      Specified by:
      getCoreMetadataList in interface loci.formats.IFormatReader
      Overrides:
      getCoreMetadataList in class loci.formats.ReaderWrapper
    • setId

      public void setId(String id) throws loci.formats.FormatException, IOException
      Specified by:
      setId in interface loci.formats.IFormatHandler
      Overrides:
      setId in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openCompressedBytes

      public byte[] openCompressedBytes(int no, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      openCompressedBytes in interface loci.formats.ICompressedTileReader
      Overrides:
      openCompressedBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • openCompressedBytes

      public byte[] openCompressedBytes(int no, byte[] buf, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      openCompressedBytes in interface loci.formats.ICompressedTileReader
      Overrides:
      openCompressedBytes in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getTileCodec

      public loci.formats.codec.Codec getTileCodec(int no) throws loci.formats.FormatException, IOException
      Specified by:
      getTileCodec in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileCodec in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • getTileCodecOptions

      public loci.formats.codec.CodecOptions getTileCodecOptions(int no, int x, int y) throws loci.formats.FormatException, IOException
      Specified by:
      getTileCodecOptions in interface loci.formats.ICompressedTileReader
      Overrides:
      getTileCodecOptions in class loci.formats.ReaderWrapper
      Throws:
      loci.formats.FormatException
      IOException
    • reorder

      protected int reorder(int no)