edu.stanford.rsl.konrad.io
Class FileProjectionSource

java.lang.Object
  extended by edu.stanford.rsl.konrad.io.FileProjectionSource
All Implemented Interfaces:
ProjectionSource
Direct Known Subclasses:
DicomProjectionSource, ImagePlusProjectionDataSource, NRRDProjectionSource, SEQProjectionSource, ZipProjectionSource

public abstract class FileProjectionSource
extends java.lang.Object
implements ProjectionSource

Class to model an abstract projection source which accesses the file system to stream the data.

Author:
akmaier

Constructor Summary
FileProjectionSource()
           
 
Method Summary
 void close()
           
 long convertToUnsignedInt(byte[] values, int index)
          converts a byte sequence to integer
 int getCurrentProjectionNumber()
          Returns the current projection number
 ij.process.ImageProcessor getNextProjection()
          Returns the next projection.
 void getNextProjection(IndividualImagePipelineFilteringTool tool)
          Writes the next projection into an IndividualImagePipelineFiltering tool, i.e.
static FileProjectionSource[] getProjectionSources()
           
abstract  void initStream(java.lang.String filename)
          Initializes the file reading.
 boolean isShowProgress()
           
static FileProjectionSource openProjectionStream(java.lang.String filename)
           
 void setShowProgress(boolean showProgress)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileProjectionSource

public FileProjectionSource()
Method Detail

initStream

public abstract void initStream(java.lang.String filename)
                         throws java.io.IOException
Initializes the file reading.

Parameters:
filename - the name of the file to read
Throws:
java.io.IOException - may happen

getProjectionSources

public static FileProjectionSource[] getProjectionSources()

openProjectionStream

public static FileProjectionSource openProjectionStream(java.lang.String filename)
                                                 throws java.io.IOException
Throws:
java.io.IOException

getNextProjection

public void getNextProjection(IndividualImagePipelineFilteringTool tool)
Description copied from interface: ProjectionSource
Writes the next projection into an IndividualImagePipelineFiltering tool, i.e. reads the projection and sets the right projection number in a synchornized manner.

Specified by:
getNextProjection in interface ProjectionSource
Parameters:
tool - the tool to write to

setShowProgress

public void setShowProgress(boolean showProgress)

isShowProgress

public boolean isShowProgress()

getCurrentProjectionNumber

public int getCurrentProjectionNumber()
Description copied from interface: ProjectionSource
Returns the current projection number

Specified by:
getCurrentProjectionNumber in interface ProjectionSource
Returns:
the number
See Also:
ProjectionSource.getNextProjection(), ProjectionSource.getNextProjection(IndividualImagePipelineFilteringTool tool)

getNextProjection

public ij.process.ImageProcessor getNextProjection()
Description copied from interface: ProjectionSource
Returns the next projection. Note that this call may be out of sync with getCurrentProjectionNumber()

Specified by:
getNextProjection in interface ProjectionSource
Returns:
the projection
See Also:
ProjectionSource.getCurrentProjectionNumber(), ProjectionSource.getNextProjection(IndividualImagePipelineFilteringTool tool)

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

convertToUnsignedInt

public long convertToUnsignedInt(byte[] values,
                                 int index)
converts a byte sequence to integer

Parameters:
values - the byte array
index - the index in 32bit integer metric
Returns:
the integer