de.unihalle.informatik.MiToBo.io.images
Class ImageReaderMTB

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.MiToBo.core.operator.MTBOperator
          extended by de.unihalle.informatik.MiToBo.io.images.ImageReaderMTB
All Implemented Interfaces:
de.unihalle.informatik.Alida.datatypes.ALDConfigurationValidator, de.unihalle.informatik.Alida.operator.events.ALDOperatorExecutionProgressEventListener, EventListener, loci.common.StatusReporter

@ALDAOperator(genericExecutionMode=ALL,
              level=APPLICATION)
public class ImageReaderMTB
extends MTBOperator
implements loci.common.StatusReporter

Image reader operator to create MTBImage or ImagePlus objects from image files while reading and restoring image history from corresponding history files (.mph). This reader operator is based on Bio-Formats, thus the available formats depend on Bio-Formats (and its available extension).

Author:
Oliver Gress

Nested Class Summary
static class ImageReaderMTB.OutImageType
          Specifies the image object that is constructed by the reader
 
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperator.HidingMode
 
Field Summary
protected  de.unihalle.informatik.Alida.datatypes.ALDFileString fileName
           
protected  int imageIndex
           
protected  loci.formats.meta.IMetadata omemeta
           
protected  String omexml
           
protected  ImageReaderMTB.OutImageType outImageType
           
protected  loci.formats.IFormatReader reader
           
protected  ij.ImagePlus resultImagePlus
           
protected  MTBImage resultMTBImage
           
 
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
 
Constructor Summary
ImageReaderMTB()
           
ImageReaderMTB(String filename)
          Constructor of an image reader instance by filename.
 
Method Summary
 void addStatusListener(loci.common.StatusListener listener)
           
 String getFileName()
          Get the filename of the image that has to be read.
 int getImageCount()
          Get the number of (multi-dimensional) images stored in the specified file.
 String getImageID(int imageIdx)
          Get the ID of the imageIdx-th image in the file, if available
 String getImageName(int imageIdx)
          Get the name of the imageIdx-th image in the file, if available
 int getIndexOfImageToRead()
          Get the index of the image that has to be read from the file.
 ImageReaderMTB.OutImageType getOutImageType()
          Get the type of image object that is created as result image.
 ij.ImagePlus getResultImagePlus()
          Get resulting image that was read from disk.
 MTBImage getResultMTBImage()
          Get resulting image that was read from disk.
protected  void initReader()
          Initialize the reader (this method is called in the constructor)
 void notifyListeners(loci.common.StatusEvent event)
           
protected  void operate()
           
protected  ij.ImagePlus readImagePlus(int imageIdx)
          Read image imageIdx from the specified file and return it as ImagePlus object.
protected  MTBImage readMTBImage(int imageIdx)
          Read image imageIdx from the specified file and return it as MTBImage object.
protected  Object readResolve()
          Init function for deserialized objects.
 void removeStatusListener(loci.common.StatusListener listener)
           
 void setFileName(String filename)
          Set the filename of the image that has to be read.
 void setIndexOfImageToRead(int imageIdx)
          Set the index of the image that has to be read from the file.
 void setOutImageType(ImageReaderMTB.OutImageType outtype)
          Set the type of image object that is created as result image.
protected  void setResultImagePlus(ij.ImagePlus img)
          Set resulting image
protected  void setResultMTBImage(MTBImage img)
          Set resulting image
 void validateCustom()
           
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperator
addOperatorExecutionProgressEventListener, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getHidingMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, runOp, runOp, runOp, setConstructionMode, setHidingMode, setName, setParameter, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected transient loci.formats.IFormatReader reader

omexml

protected String omexml

omemeta

protected transient loci.formats.meta.IMetadata omemeta

imageIndex

@Parameter(label="Image index",
           required=true,
           direction=IN,
           mode=ADVANCED,
           dataIOOrder=2,
           description="Index of the image (aka series) in the file that has to be read")
protected int imageIndex

outImageType

@Parameter(label="Output image type",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=3,
           description="Determines the image object class that is created as result image")
protected ImageReaderMTB.OutImageType outImageType

fileName

@Parameter(label="Filename",
           required=true,
           direction=IN,
           mode=STANDARD,
           dataIOOrder=1,
           description="Filename of the image to be read")
protected de.unihalle.informatik.Alida.datatypes.ALDFileString fileName

resultImagePlus

@Parameter(label="Result ImagePlus",
           required=false,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=2,
           description="Image that has been read from disk returned as ImagePlus")
protected transient ij.ImagePlus resultImagePlus

resultMTBImage

@Parameter(label="Result MTBImage",
           required=false,
           direction=OUT,
           mode=STANDARD,
           dataIOOrder=1,
           description="Image that has been read from disk returned as MTBImage")
protected transient MTBImage resultMTBImage
Constructor Detail

ImageReaderMTB

public ImageReaderMTB()
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

ImageReaderMTB

public ImageReaderMTB(String filename)
               throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                      loci.formats.FormatException,
                      IOException,
                      loci.common.services.DependencyException,
                      loci.common.services.ServiceException
Constructor of an image reader instance by filename.

Parameters:
filename -
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
loci.formats.FormatException
IOException
loci.common.services.DependencyException
loci.common.services.ServiceException
Method Detail

readResolve

protected Object readResolve()
Init function for deserialized objects.

This function is called on an instance of this class being deserialized from file, prior to handing the instance over to the user. It takes care of a proper initialization of transient member variables as they are not initialized to the default values during deserialization.

Overrides:
readResolve in class MTBOperator
Returns:
Initialized deserialized object.

operate

protected void operate()
                throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException,
                       de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
Specified by:
operate in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException

validateCustom

public void validateCustom()
                    throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Overrides:
validateCustom in class de.unihalle.informatik.Alida.operator.ALDOperator
Throws:
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

initReader

protected void initReader()
                   throws loci.formats.FormatException,
                          IOException,
                          loci.common.services.DependencyException,
                          loci.common.services.ServiceException
Initialize the reader (this method is called in the constructor)

Throws:
loci.formats.FormatException
IOException
loci.common.services.DependencyException
loci.common.services.ServiceException

readMTBImage

protected MTBImage readMTBImage(int imageIdx)
                         throws loci.formats.FormatException,
                                IOException,
                                IllegalArgumentException,
                                loci.common.services.DependencyException,
                                loci.common.services.ServiceException,
                                de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Read image imageIdx from the specified file and return it as MTBImage object. Some formats can store a series of image, e.g. different experiment runs (not to confuse with a time series). The imageIdx specifies which image of a series has to be read.

Throws:
loci.formats.FormatException
IOException
IllegalArgumentException
loci.common.services.DependencyException
loci.common.services.ServiceException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

readImagePlus

protected ij.ImagePlus readImagePlus(int imageIdx)
                              throws loci.formats.FormatException,
                                     IOException,
                                     loci.common.services.DependencyException,
                                     loci.common.services.ServiceException,
                                     IllegalArgumentException,
                                     de.unihalle.informatik.Alida.exceptions.ALDOperatorException
Read image imageIdx from the specified file and return it as ImagePlus object. Some formats can store a series of image, e.g. different experiment runs (not to confuse with a time series). The imageIdx specifies which image of a series has to be read.

Throws:
loci.formats.FormatException
IOException
loci.common.services.DependencyException
loci.common.services.ServiceException
IllegalArgumentException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException

setResultMTBImage

protected void setResultMTBImage(MTBImage img)
Set resulting image


setResultImagePlus

protected void setResultImagePlus(ij.ImagePlus img)
Set resulting image


getResultMTBImage

public MTBImage getResultMTBImage()
Get resulting image that was read from disk.


getResultImagePlus

public ij.ImagePlus getResultImagePlus()
Get resulting image that was read from disk.


setFileName

public void setFileName(String filename)
                 throws loci.formats.FormatException,
                        IOException,
                        loci.common.services.DependencyException,
                        loci.common.services.ServiceException
Set the filename of the image that has to be read.

Throws:
loci.formats.FormatException
IOException
loci.common.services.DependencyException
loci.common.services.ServiceException

getFileName

public String getFileName()
Get the filename of the image that has to be read.


setOutImageType

public void setOutImageType(ImageReaderMTB.OutImageType outtype)
Set the type of image object that is created as result image. Default is OutImageType.MTB_IMAGE


getOutImageType

public ImageReaderMTB.OutImageType getOutImageType()
Get the type of image object that is created as result image. Default is OutImageType.MTB_IMAGE


getImageCount

public int getImageCount()
Get the number of (multi-dimensional) images stored in the specified file.


getImageName

public String getImageName(int imageIdx)
Get the name of the imageIdx-th image in the file, if available


getImageID

public String getImageID(int imageIdx)
Get the ID of the imageIdx-th image in the file, if available


setIndexOfImageToRead

public void setIndexOfImageToRead(int imageIdx)
Set the index of the image that has to be read from the file. Some files may contain more than one multi-dimensional image. Default is 0.


getIndexOfImageToRead

public int getIndexOfImageToRead()
Get the index of the image that has to be read from the file. Some files may contain more than one multi-dimensional image. Default is 0.


addStatusListener

public void addStatusListener(loci.common.StatusListener listener)
Specified by:
addStatusListener in interface loci.common.StatusReporter

notifyListeners

public void notifyListeners(loci.common.StatusEvent event)
Specified by:
notifyListeners in interface loci.common.StatusReporter

removeStatusListener

public void removeStatusListener(loci.common.StatusListener listener)
Specified by:
removeStatusListener in interface loci.common.StatusReporter


Copyright © 2010–2015 Martin Luther University Halle-Wittenberg. All rights reserved.