Class WriteIntoDirectory

Object
WriteIntoDirectory

public class WriteIntoDirectory extends Object
Writes one or more stacks/objects/channels into a directory during testing.

Any checked-exceptions thrown during writing stacks are converted into run-time exceptions, to make it easy to temporarily use this class in a test for debugging with minimal alteration of functions.

Author:
Owen Feehan
  • Constructor Details

    • WriteIntoDirectory

      public WriteIntoDirectory(Path directory)
      Creates a new WriteIntoDirectory instance with directory printing enabled.

      This constructor sets printDirectoryToConsole to true, meaning the directory path will be printed to the console when the first output is written.

      Parameters:
      directory - the directory in which stacks and other outputs will be written. It should be a valid, writable directory path.
    • WriteIntoDirectory

      public WriteIntoDirectory(Path directory, boolean printDirectoryToConsole)
      Creates a new WriteIntoDirectory instance.
      Parameters:
      directory - The directory in which stacks and other outputs are written.

      This directory is used as the root location for all file outputs generated by this class. It should be a valid, writable directory path.

      If printDirectoryToConsole is set to true, this directory path will be printed to the console when the first output is written.

      printDirectoryToConsole - If true, the path of folder is printed to the console
      See Also:
      • printDirectoryToConsole
  • Method Details

    • writeStack

      public void writeStack(String outputName, DisplayStack stack)
      Writes a DisplayStack to the output directory.
      Parameters:
      outputName - The name to use for the output file.
      stack - The DisplayStack to write.
    • writeObject

      public void writeObject(String outputName, ObjectMask object) throws SetOperationFailedException
      Writes an ObjectMask to the output directory.
      Parameters:
      outputName - The name to use for the output file.
      object - The ObjectMask to write.
      Throws:
      SetOperationFailedException - If the operation fails.
    • writeObjects

      public void writeObjects(String outputName, ObjectCollection objects)
      Writes the outline of objects on a blank RGB image, inferring dimensions of the image to center the object.
      Parameters:
      outputName - output-name
      objects - the objects to draw an outline for
    • writeObjects

      public void writeObjects(String outputName, ObjectCollection objects, Stack background)
      Writes the outline of objects on a background.
      Parameters:
      outputName - output-name
      objects - the objects to draw an outline for
      background - the background
    • writeVoxels

      public void writeVoxels(String outputName, Voxels<UnsignedByteBuffer> voxels)
      Writes Voxels to the output directory.
      Parameters:
      outputName - The name to use for the output file.
      voxels - The Voxels to write.
    • writeChannel

      public void writeChannel(String outputName, Channel channel)
      Writes a Channel to the output directory.
      Parameters:
      outputName - The name to use for the output file.
      channel - The Channel to write.
    • writeList

      public void writeList(String outputName, List<DisplayStack> stacks, boolean always2D) throws OutputWriteFailedException
      Writes a list of display-stacks.
      Parameters:
      outputName - the output-name
      stacks - the list of display-stacks
      always2D - if true, the stacks are guaranteed to always to have only one z-slice (which can influence the output format).
      Throws:
      OutputWriteFailedException - if the stacks cannot be successfully written to the file-system.
    • getDirectory

      public Path getDirectory()
      The directory in which stacks and other outputs are written.

      This directory is used as the root location for all file outputs generated by this class. It should be a valid, writable directory path.

      If printDirectoryToConsole is set to true, this directory path will be printed to the console when the first output is written.

      See Also:
      • printDirectoryToConsole