Package org.itk.simple
Class Image
java.lang.Object
org.itk.simple.Image
The Image class for SimpleITK.
This Image class can represent 2D, 3D, and 4D images. The pixel types may be a
scalar, a multi-component vector or a run-length-encoded (RLE)
"label". The dimension, pixel type and size is specified at
construction.
A fundamental concept of ITK images is that they occupy physical space
where the image is defined by an origin, spacing, and direction cosine
matrix. The attributes are taken into consideration when doing most
operations on an image. A meta-data dictionary is also associated with
the image, which may contain additional fields from reading but these
attributes are not propagated by image filters.
The SimpleITK Image provides a single facade interface to several ITK image types.
Internally, the SimpleITK Image maintains a pointer to the ITK image class, and performs reference
counting and lazy copying. This means that deep copying of an image
including it's buffer is delayed until the image is modified. This
removes the need to use pointers to SimpleITK Image class, as copying and returning by value do not unnecessarily
duplicate the data.
/sa itk::Image itk::VectorImage itk::LabelMap itk::ImageBase
C++ includes: sitkImage.h
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionImage()
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment.protected
Image
(long cPtr, boolean cMemoryOwn) Image
(long width, long height, long depth, PixelIDValueEnum valueEnum) itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment.Image
(long width, long height, PixelIDValueEnum valueEnum) itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment.itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment.Image
(VectorUInt32 size, PixelIDValueEnum valueEnum) itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment.Image
(VectorUInt32 size, PixelIDValueEnum valueEnum, long numberOfComponents) itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyInformation
(Image srcImage) void itk::simple::Image::CopyInformation(const Image &srcImage) Copy common meta-data from an image to this one.void
delete()
virtual itk::simple::Image::~Image()boolean
eraseMetaData
(String key) bool itk::simple::Image::EraseMetaData(const std::string &key) Remove an entry from the meta-data dictionary.std::vector<double> itk::simple::Image::EvaluateAtContinuousIndex(const std::vector< double > &index, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a continuous index.evaluateAtContinuousIndex
(VectorDouble index, InterpolatorEnum interp) std::vector<double> itk::simple::Image::EvaluateAtContinuousIndex(const std::vector< double > &index, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a continuous index.std::vector<double> itk::simple::Image::EvaluateAtPhysicalPoint(const std::vector< double > &point, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a physical point.evaluateAtPhysicalPoint
(VectorDouble point, InterpolatorEnum interp) std::vector<double> itk::simple::Image::EvaluateAtPhysicalPoint(const std::vector< double > &point, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a physical point.protected void
finalize()
Return a Buffer object for the Image's buffer.long
protected static long
long
getDepth()
unsigned int itk::simple::Image::GetDepth() const Get the number of pixels the Image is in the third dimension or 0 if the Image is only 2Dlong
unsigned int itk::simple::Image::GetDimension() const Get the number of physical dimensions.long
unsigned int itk::simple::Image::GetHeight() const Get the number of pixels the Image is in the second dimensiongetMetaData
(String key) std::string itk::simple::Image::GetMetaData(const std::string &key) const Get the value of a meta-data dictionary entry as a string.std::vector<std::string> itk::simple::Image::GetMetaDataKeys() const get a vector of keys in from the meta-data dictionary Returns a vector of keys to the key/value entries in the image's meta- data dictionary.long
unsigned int itk::simple::Image::GetNumberOfComponentsPerPixel() const Get the number of components for each pixel.long
uint64_t itk::simple::Image::GetNumberOfPixels() const Get the number of pixels in the image.double
float
short
int
int
byte
int
long
long
short
PixelIDValueEnum itk::simple::Image::GetPixelID() const Get the pixel type The pixel type is set at construction type and can not be manually changed, unless by assignment.std::string itk::simple::Image::GetPixelIDTypeAsString() const Return the pixel type as a human readable string value.int
PixelIDValueType itk::simple::Image::GetPixelIDValue() constgetSize()
std::vector< unsigned int > itk::simple::Image::GetSize() const Get the number of pixels the Image is in each dimension as a std::vector.long
unsigned int itk::simple::Image::GetSizeOfPixelComponent() const Get the number of bytes per component of a pixel.long
getWidth()
unsigned int itk::simple::Image::GetWidth() const Get the number of pixels the Image is in the first dimensionboolean
hasMetaDataKey
(String key) bool itk::simple::Image::HasMetaDataKey(const std::string &key) const Query the meta-data dictionary for the existence of a key.boolean
isUnique()
bool itk::simple::Image::IsUnique() const Returns true if no other SimpleITK Image object refers to the same internal data structure.void
void itk::simple::Image::MakeUnique() Performs actually coping if needed to make object unique.void
setDirection
(VectorDouble direction) void
setMetaData
(String key, String value) void itk::simple::Image::SetMetaData(const std::string &key, const std::string &value) Set an entry in the meta-data dictionary.void
setOrigin
(VectorDouble origin) void
void
void
setPixelAsDouble
(VectorUInt32 idx, double v) void
setPixelAsFloat
(VectorUInt32 idx, float v) void
setPixelAsInt16
(VectorUInt32 idx, short v) void
setPixelAsInt32
(VectorUInt32 idx, int v) void
setPixelAsInt64
(VectorUInt32 idx, int v) void
setPixelAsInt8
(VectorUInt32 idx, byte v) void
setPixelAsUInt16
(VectorUInt32 idx, int v) void
setPixelAsUInt32
(VectorUInt32 idx, long v) void
setPixelAsUInt64
(VectorUInt32 idx, long v) void
setPixelAsUInt8
(VectorUInt32 idx, short v) void
void
void
void
void
void
void
void
void
void
void
setSpacing
(VectorDouble spacing) protected static long
swigRelease
(Image obj) Image itk::simple::Image::ToScalarImage(bool inPlace=true) Convert a image of vector pixel type to a scalar image with N+1 dimensions.toScalarImage
(boolean inPlace) Image itk::simple::Image::ToScalarImage(bool inPlace=true) Convert a image of vector pixel type to a scalar image with N+1 dimensions.toString()
std::string itk::simple::Image::ToString() constImage itk::simple::Image::ToVectorImage(bool inPlace=true) Convert the first dimension to the components for image with vector pixel type.toVectorImage
(boolean inPlace) Image itk::simple::Image::ToVectorImage(bool inPlace=true) Convert the first dimension to the components for image with vector pixel type.std::vector< double > itk::simple::Image::TransformContinuousIndexToPhysicalPoint(const std::vector< double > &index) const Transform continuous index to physical pointstd::vector< double > itk::simple::Image::TransformIndexToPhysicalPoint(const std::vector< int64_t > &index) const Transform index to physical pointstd::vector< double > itk::simple::Image::TransformPhysicalPointToContinuousIndex(const std::vector< double > &point) const Transform physical point to continuous indexstd::vector< int64_t > itk::simple::Image::TransformPhysicalPointToIndex(const std::vector< double > &point) const Transform physical point to index
-
Field Details
-
swigCMemOwn
protected transient boolean swigCMemOwn
-
-
Constructor Details
-
Image
protected Image(long cPtr, boolean cMemoryOwn) -
Image
public Image()itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior. -
Image
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior. -
Image
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior. -
Image
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior. -
Image
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior. -
Image
itk::simple::Image::Image(Image &&img) noexcept Move constructor and assignment. Parameters: img: After the operation img is valid only for destructing and assignment; all other operations have undefined behavior.
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize() -
delete
public void delete()virtual itk::simple::Image::~Image() -
getBufferAsBuffer
Return a Buffer object for the Image's buffer. If the image's pixel component type is available in Java, then the return object is the appropriate derived object from the Buffer class. -
getITKBase
-
getPixelID
PixelIDValueEnum itk::simple::Image::GetPixelID() const Get the pixel type The pixel type is set at construction type and can not be manually changed, unless by assignment. The value may be -1 or "Unknown". -
getPixelIDValue
public int getPixelIDValue()PixelIDValueType itk::simple::Image::GetPixelIDValue() const -
getPixelIDTypeAsString
std::string itk::simple::Image::GetPixelIDTypeAsString() const Return the pixel type as a human readable string value. -
getDimension
public long getDimension()unsigned int itk::simple::Image::GetDimension() const Get the number of physical dimensions. Only the spatial dimensions are considered here. These are the dimensions the origin, spacing and direction cosine matrix are applicable to. This does not include the pixels' vector index as a dimension. -
getNumberOfComponentsPerPixel
public long getNumberOfComponentsPerPixel()unsigned int itk::simple::Image::GetNumberOfComponentsPerPixel() const Get the number of components for each pixel. For images with scalar or complex pixel types this method returns one. For images with a vector pixel type the method returns the number of vector components per pixel. -
getNumberOfPixels
public long getNumberOfPixels()uint64_t itk::simple::Image::GetNumberOfPixels() const Get the number of pixels in the image. To calculate the total number of values stored continuously for the image's buffer, the NumberOfPixels should be multiplied by NumberOfComponentsPerPixel in order to account for multiple component images. -
getSizeOfPixelComponent
public long getSizeOfPixelComponent()unsigned int itk::simple::Image::GetSizeOfPixelComponent() const Get the number of bytes per component of a pixel. Returns the sizeof the pixel component type. -
getOrigin
-
setOrigin
-
getSpacing
-
setSpacing
-
getDirection
-
setDirection
-
transformIndexToPhysicalPoint
std::vector< double > itk::simple::Image::TransformIndexToPhysicalPoint(const std::vector< int64_t > &index) const Transform index to physical point -
transformPhysicalPointToIndex
std::vector< int64_t > itk::simple::Image::TransformPhysicalPointToIndex(const std::vector< double > &point) const Transform physical point to index -
transformPhysicalPointToContinuousIndex
std::vector< double > itk::simple::Image::TransformPhysicalPointToContinuousIndex(const std::vector< double > &point) const Transform physical point to continuous index -
transformContinuousIndexToPhysicalPoint
std::vector< double > itk::simple::Image::TransformContinuousIndexToPhysicalPoint(const std::vector< double > &index) const Transform continuous index to physical point -
evaluateAtContinuousIndex
std::vector<double> itk::simple::Image::EvaluateAtContinuousIndex(const std::vector< double > &index, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a continuous index. This method is not supported for Label pixel types. The valid range of continuous index is [-0.5, size-0.5] for each dimension. An exception is thrown if index is out of bounds. Parameters: index: The continuous index must be at least the length of the image dimension. interp: The interpolation type to use, only sitkNearest and sitkLinear are supported for Vector and Complex pixel types. All supported pixel types are returned as an array, where complex numbers are returned with the real followed by the complex component. -
evaluateAtContinuousIndex
std::vector<double> itk::simple::Image::EvaluateAtContinuousIndex(const std::vector< double > &index, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a continuous index. This method is not supported for Label pixel types. The valid range of continuous index is [-0.5, size-0.5] for each dimension. An exception is thrown if index is out of bounds. Parameters: index: The continuous index must be at least the length of the image dimension. interp: The interpolation type to use, only sitkNearest and sitkLinear are supported for Vector and Complex pixel types. All supported pixel types are returned as an array, where complex numbers are returned with the real followed by the complex component. -
evaluateAtPhysicalPoint
std::vector<double> itk::simple::Image::EvaluateAtPhysicalPoint(const std::vector< double > &point, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a physical point. This method is not supported for Label pixel types. An exception is thrown if the point is out of the defined region for the image. Parameters: point: The physical point at which the interpolation is computed. interp: The interpolation type to use, only sitkNearest and sitkLinear are supported for Vector and Complex pixel types. All supported pixel types are returned as an array, where complex numbers are returned with the real followed by the complex component. -
evaluateAtPhysicalPoint
std::vector<double> itk::simple::Image::EvaluateAtPhysicalPoint(const std::vector< double > &point, InterpolatorEnum interp=sitkLinear) const Interpolate pixel value at a physical point. This method is not supported for Label pixel types. An exception is thrown if the point is out of the defined region for the image. Parameters: point: The physical point at which the interpolation is computed. interp: The interpolation type to use, only sitkNearest and sitkLinear are supported for Vector and Complex pixel types. All supported pixel types are returned as an array, where complex numbers are returned with the real followed by the complex component. -
getSize
std::vector< unsigned int > itk::simple::Image::GetSize() const Get the number of pixels the Image is in each dimension as a std::vector. The size of the vector is equal to the number of dimensions for the image. -
getWidth
public long getWidth()unsigned int itk::simple::Image::GetWidth() const Get the number of pixels the Image is in the first dimension -
getHeight
public long getHeight()unsigned int itk::simple::Image::GetHeight() const Get the number of pixels the Image is in the second dimension -
getDepth
public long getDepth()unsigned int itk::simple::Image::GetDepth() const Get the number of pixels the Image is in the third dimension or 0 if the Image is only 2D -
copyInformation
void itk::simple::Image::CopyInformation(const Image &srcImage) Copy common meta-data from an image to this one. Copies the Origin, Spacing, and Direction from the source image to this image. The meta-data dictionary is not copied. It is required for the source Image's dimension and size to match, this image's attributes, otherwise an exception will be generated. -
getMetaDataKeys
std::vector<std::string> itk::simple::Image::GetMetaDataKeys() const get a vector of keys in from the meta-data dictionary Returns a vector of keys to the key/value entries in the image's meta- data dictionary. Iterate through with these keys to get the values. -
hasMetaDataKey
bool itk::simple::Image::HasMetaDataKey(const std::string &key) const Query the meta-data dictionary for the existence of a key. -
getMetaData
std::string itk::simple::Image::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 strings. Other types are printed to string before returning. -
setMetaData
void itk::simple::Image::SetMetaData(const std::string &key, const std::string &value) Set an entry in the meta-data dictionary. Replaces or creates an entry in the image's meta-data dictionary. -
eraseMetaData
bool itk::simple::Image::EraseMetaData(const std::string &key) Remove an entry from the meta-data dictionary. Returns true, when the value exists in the dictionary and is removed, false otherwise. -
toString
std::string itk::simple::Image::ToString() const -
toVectorImage
Image itk::simple::Image::ToVectorImage(bool inPlace=true) Convert the first dimension to the components for image with vector pixel type. This method will convert a scalar image to a vector image with the number of components equal to the size of the first dimension. If the image is already a vector image then the image is returned. The components of the direction cosine matrix for the first dimension must be the identity matrix, or else an exception is thrown. An exception is thrown if the image is 2D or if the pixel type is a label or complex pixel type. Parameters: inPlace: If true then the image is made unique and converted in place updating this image, otherwise a copy of the image is made and returned. See: ToScalarImage -
toVectorImage
Image itk::simple::Image::ToVectorImage(bool inPlace=true) Convert the first dimension to the components for image with vector pixel type. This method will convert a scalar image to a vector image with the number of components equal to the size of the first dimension. If the image is already a vector image then the image is returned. The components of the direction cosine matrix for the first dimension must be the identity matrix, or else an exception is thrown. An exception is thrown if the image is 2D or if the pixel type is a label or complex pixel type. Parameters: inPlace: If true then the image is made unique and converted in place updating this image, otherwise a copy of the image is made and returned. See: ToScalarImage -
toScalarImage
Image itk::simple::Image::ToScalarImage(bool inPlace=true) Convert a image of vector pixel type to a scalar image with N+1 dimensions. This method will convert a vector image to a scalar image with the size of the first dimension equal to the number of components. If the image is already a scalar image then the image is returned. For the additional dimension the origin is set to zero, the spacing to one, and the new components of the direction cosine to the identity matrix. An exception is thrown if the image is has SITK_MAX_DIMENSION dimensions or if the pixel type is a label or complex pixel type. Parameters: inPlace: If true then the image is made unique and converted in place updating this image, otherwise a copy of the image is made and returned. See: ToVectorImage -
toScalarImage
Image itk::simple::Image::ToScalarImage(bool inPlace=true) Convert a image of vector pixel type to a scalar image with N+1 dimensions. This method will convert a vector image to a scalar image with the size of the first dimension equal to the number of components. If the image is already a scalar image then the image is returned. For the additional dimension the origin is set to zero, the spacing to one, and the new components of the direction cosine to the identity matrix. An exception is thrown if the image is has SITK_MAX_DIMENSION dimensions or if the pixel type is a label or complex pixel type. Parameters: inPlace: If true then the image is made unique and converted in place updating this image, otherwise a copy of the image is made and returned. See: ToVectorImage -
getPixelAsInt8
-
getPixelAsUInt8
-
getPixelAsInt16
-
getPixelAsUInt16
-
getPixelAsInt32
-
getPixelAsUInt32
-
getPixelAsInt64
-
getPixelAsUInt64
-
getPixelAsFloat
-
getPixelAsDouble
-
getPixelAsVectorInt8
-
getPixelAsVectorUInt8
-
getPixelAsVectorInt16
-
getPixelAsVectorUInt16
-
getPixelAsVectorInt32
-
getPixelAsVectorUInt32
-
getPixelAsVectorInt64
-
getPixelAsVectorUInt64
-
getPixelAsVectorFloat32
-
getPixelAsVectorFloat64
-
getPixelAsComplexFloat32
-
getPixelAsComplexFloat64
-
setPixelAsInt8
-
setPixelAsUInt8
-
setPixelAsInt16
-
setPixelAsUInt16
-
setPixelAsInt32
-
setPixelAsUInt32
-
setPixelAsInt64
-
setPixelAsUInt64
-
setPixelAsFloat
-
setPixelAsDouble
-
setPixelAsVectorInt8
-
setPixelAsVectorUInt8
-
setPixelAsVectorInt16
-
setPixelAsVectorUInt16
-
setPixelAsVectorInt32
-
setPixelAsVectorUInt32
-
setPixelAsVectorInt64
-
setPixelAsVectorUInt64
-
setPixelAsVectorFloat32
-
setPixelAsVectorFloat64
-
setPixelAsComplexFloat32
-
setPixelAsComplexFloat64
-
getBufferAsByteBuffer
-
makeUnique
public void makeUnique()void itk::simple::Image::MakeUnique() Performs actually coping if needed to make object unique. The Image class by default performs lazy coping and assignment. This method make sure that coping actually happens to the itk::Image pointed to is only pointed to by this object. -
isUnique
public boolean isUnique()bool itk::simple::Image::IsUnique() const Returns true if no other SimpleITK Image object refers to the same internal data structure. -
getBufferAsNativePointer
public long getBufferAsNativePointer()
-