Package org.itk.simple
Class ImageFileReader
java.lang.Object
org.itk.simple.ProcessObject
org.itk.simple.ImageReaderBase
org.itk.simple.ImageFileReader
Read an image file and return a SimpleITK Image.
The reader can handle scalar images, and vector images. Pixel types
such as RGB, RGBA are loaded as multi-component images with vector
pixel types. Additionally, tensor images are loaded with the pixel
type being a 1-d vector.
An interface is also provided to access the information from the
underlying itk::ImageIO. This information can be loaded with the
ReadImageInformation method. The information is from the itk::ImageIO
interface. In some degenerate cases reading the bulk data may produce
different results. Please see itk::ImageFileReader for more details.
Reading takes place by the ITK ImageIO factory mechanism. ITK contains
many ImageIO classes which are responsible for reading separate file
formats. By default, each ImageIO is asked if it "can read" the
file, and the first one which "can read" the format is used. The
list of available ImageIOs can be obtained using the
GetRegisteredImageIOs method. The ImageIO used can be overridden with
the SetImageIO method. This is useful in cases when multiple ImageIOs
"can read" the file and the user wants to select a specific IO (not
the first).
See:
itk::simple::ReadImage for the procedural interface
C++ includes: sitkImageFileReader.h
-
Field Summary
Fields inherited from class org.itk.simple.ProcessObject
swigCMemOwn
-
Constructor Summary
ConstructorsModifierConstructorDescriptionitk::simple::ImageFileReader::ImageFileReader()protected
ImageFileReader
(long cPtr, boolean cMemoryOwn) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
itk::simple::ImageFileReader::~ImageFileReader() overrideexecute()
Image itk::simple::ImageFileReader::Execute() override Set/Get The output PixelType of the image.protected void
finalize()
protected static long
getCPtr
(ImageFileReader obj) long
const std::vector<int>& itk::simple::ImageFileReader::GetExtractIndex() constconst std::vector<unsigned int>& itk::simple::ImageFileReader::GetExtractSize() conststd::string itk::simple::ImageFileReader::GetFileName() constgetMetaData
(String key) std::string itk::simple::ImageFileReader::GetMetaData(const std::string &key) const Get the value of a meta-data dictionary entry as a string.std::vector<std::string> itk::simple::ImageFileReader::GetMetaDataKeys() const Get the meta-data dictionary keys.getName()
std::string itk::simple::ImageFileReader::GetName() const override return user readable name of the filterlong
int
getSize()
boolean
hasMetaDataKey
(String key) bool itk::simple::ImageFileReader::HasMetaDataKey(const std::string &key) const Query a meta-data dictionary for the existence of a key.void
void itk::simple::ImageFileReader::ReadImageInformation() Read only the meta-data and image information in the file.void
setExtractIndex
(VectorInt32 index) Self& itk::simple::ImageFileReader::SetExtractIndex(const std::vector< int > &index) starting index from the image on disk to extract.void
setExtractSize
(VectorUInt32 size) Self& itk::simple::ImageFileReader::SetExtractSize(const std::vector< unsigned int > &size) size of image to extract from file.void
setFileName
(String fn) Self& itk::simple::ImageFileReader::SetFileName(const std::string &fn)protected static long
toString()
std::string itk::simple::ImageFileReader::ToString() const override Print ourselves to stringMethods inherited from class org.itk.simple.ImageReaderBase
getCPtr, getImageIO, getImageIOFromFileName, getLoadPrivateTags, getOutputPixelType, getRegisteredImageIOs, loadPrivateTagsOff, loadPrivateTagsOn, setImageIO, setLoadPrivateTags, setOutputPixelType, swigRelease
Methods inherited from class org.itk.simple.ProcessObject
abort, addCommand, debugOff, debugOn, getCPtr, getDebug, getGlobalDefaultCoordinateTolerance, getGlobalDefaultDebug, getGlobalDefaultDirectionTolerance, getGlobalDefaultNumberOfThreads, getGlobalDefaultThreader, getGlobalWarningDisplay, getNumberOfThreads, getNumberOfWorkUnits, getProgress, globalDefaultDebugOff, globalDefaultDebugOn, globalWarningDisplayOff, globalWarningDisplayOn, hasCommand, removeAllCommands, setDebug, setGlobalDefaultCoordinateTolerance, setGlobalDefaultDebug, setGlobalDefaultDirectionTolerance, setGlobalDefaultNumberOfThreads, setGlobalDefaultThreader, setGlobalWarningDisplay, setNumberOfThreads, setNumberOfWorkUnits, swigRelease
-
Constructor Details
-
ImageFileReader
protected ImageFileReader(long cPtr, boolean cMemoryOwn) -
ImageFileReader
public ImageFileReader()itk::simple::ImageFileReader::ImageFileReader()
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classImageReaderBase
-
delete
public void delete()itk::simple::ImageFileReader::~ImageFileReader() override- Overrides:
delete
in classImageReaderBase
-
toString
std::string itk::simple::ImageFileReader::ToString() const override Print ourselves to string- Overrides:
toString
in classImageReaderBase
-
getName
std::string itk::simple::ImageFileReader::GetName() const override return user readable name of the filter- Overrides:
getName
in classProcessObject
-
setFileName
Self& itk::simple::ImageFileReader::SetFileName(const std::string &fn) -
getFileName
std::string itk::simple::ImageFileReader::GetFileName() const -
execute
Image itk::simple::ImageFileReader::Execute() override Set/Get The output PixelType of the image. By default the value is sitkUnknown, which enable the output pixel type to be same as the file. If the pixel type is specified then the itk::ConvertPixelBuffer will be used to convert the pixels.- Overrides:
execute
in classImageReaderBase
-
readImageInformation
public void readImageInformation()void itk::simple::ImageFileReader::ReadImageInformation() Read only the meta-data and image information in the file. This method can be used to determine what the size and pixel type of an image file is without reading the whole image. Even if SimpleITK does not support an image of a certain dimension or type, the meta- information can still be read. -
getPixelID
-
getPixelIDValue
public int getPixelIDValue() -
getDimension
public long getDimension() -
getNumberOfComponents
public long getNumberOfComponents() -
getOrigin
-
getSpacing
-
getDirection
-
getSize
-
getMetaDataKeys
std::vector<std::string> itk::simple::ImageFileReader::GetMetaDataKeys() const Get the meta-data dictionary keys. This is only valid after successful ReadImageInformation or Execute of this filter. Returns a vector of keys to the key/value entries in the file's meta- data dictionary. Iterate through with these keys to get the values. -
hasMetaDataKey
bool itk::simple::ImageFileReader::HasMetaDataKey(const std::string &key) const Query a meta-data dictionary for the existence of a key. -
getMetaData
std::string itk::simple::ImageFileReader::GetMetaData(const std::string &key) const Get the value of a meta-data dictionary entry as a string. If the key is not in the dictionary then an exception is thrown. String types in the dictionary are returned as their native string. Other types are printed to string before returning. -
setExtractSize
Self& itk::simple::ImageFileReader::SetExtractSize(const std::vector< unsigned int > &size) size of image to extract from file. By default the reader loads the entire image, this is specified when the size has zero length. If specified, then the image returned from Execute will be of this size. If the ImageIO and file support reading just a region, then the reader will perform streaming. The dimension of the image can be reduced by specifying a dimension's size as 0. For example a size of $[10,20,30,0,0]$ results in a 3D image with size of $[10,20,30]$. This enables reading a 5D image into a 3D image. If the length of the specified size is greater than the dimension of the image file, an exception will be generated. If the size's length is less than the image's dimension then the missing values are assumed to be zero. When the dimension of the image is reduced, the direction cosine matrix will be set to the identity. However, the spacing for the selected axis will remain. The matrix from the file can still be obtained by ImageFileReader::GetDirection. /sa ExtractImageFilter -
getExtractSize
const std::vector<unsigned int>& itk::simple::ImageFileReader::GetExtractSize() const -
setExtractIndex
Self& itk::simple::ImageFileReader::SetExtractIndex(const std::vector< int > &index) starting index from the image on disk to extract. Missing dimensions are treated the same as 0. /sa ExtractImageFilter -
getExtractIndex
const std::vector<int>& itk::simple::ImageFileReader::GetExtractIndex() const
-