Class Image

java.lang.Object
org.itk.simple.Image

public class Image extends Object
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 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

      public Image(Image img)
      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

      public Image(long width, long height, PixelIDValueEnum valueEnum)
      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

      public Image(long width, long height, long depth, PixelIDValueEnum valueEnum)
      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

      public Image(VectorUInt32 size, PixelIDValueEnum valueEnum, long numberOfComponents)
      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

      public Image(VectorUInt32 size, PixelIDValueEnum valueEnum)
      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

      protected static long getCPtr(Image obj)
    • swigRelease

      protected static long swigRelease(Image obj)
    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • delete

      public void delete()
      virtual itk::simple::Image::~Image()
    • getBufferAsBuffer

      public Buffer 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

      public SWIGTYPE_p_itk__DataObject getITKBase()
    • getPixelID

      public PixelIDValueEnum 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

      public String 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

      public VectorDouble getOrigin()
    • setOrigin

      public void setOrigin(VectorDouble origin)
    • getSpacing

      public VectorDouble getSpacing()
    • setSpacing

      public void setSpacing(VectorDouble spacing)
    • getDirection

      public VectorDouble getDirection()
    • setDirection

      public void setDirection(VectorDouble direction)
    • transformIndexToPhysicalPoint

      public VectorDouble transformIndexToPhysicalPoint(VectorInt64 index)
      std::vector< double > itk::simple::Image::TransformIndexToPhysicalPoint(const std::vector< int64_t > &index) const Transform index to physical point
    • transformPhysicalPointToIndex

      public VectorInt64 transformPhysicalPointToIndex(VectorDouble point)
      std::vector< int64_t > itk::simple::Image::TransformPhysicalPointToIndex(const std::vector< double > &point) const Transform physical point to index
    • transformPhysicalPointToContinuousIndex

      public VectorDouble transformPhysicalPointToContinuousIndex(VectorDouble point)
      std::vector< double > itk::simple::Image::TransformPhysicalPointToContinuousIndex(const std::vector< double > &point) const Transform physical point to continuous index
    • transformContinuousIndexToPhysicalPoint

      public VectorDouble transformContinuousIndexToPhysicalPoint(VectorDouble index)
      std::vector< double > itk::simple::Image::TransformContinuousIndexToPhysicalPoint(const std::vector< double > &index) const Transform continuous index to physical point
    • evaluateAtContinuousIndex

      public VectorDouble 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. 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

      public VectorDouble evaluateAtContinuousIndex(VectorDouble index)
      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

      public VectorDouble 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. 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

      public VectorDouble evaluateAtPhysicalPoint(VectorDouble point)
      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

      public VectorUInt32 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

      public void copyInformation(Image srcImage)
      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

      public VectorString 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

      public boolean hasMetaDataKey(String key)
      bool itk::simple::Image::HasMetaDataKey(const std::string &key) const Query the meta-data dictionary for the existence of a key.
    • getMetaData

      public String getMetaData(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. 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

      public 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. Replaces or creates an entry in the image's meta-data dictionary.
    • eraseMetaData

      public boolean eraseMetaData(String key)
      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

      public String toString()
      std::string itk::simple::Image::ToString() const
      Overrides:
      toString in class Object
    • toVectorImage

      public Image toVectorImage(boolean inPlace)
      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

      public Image 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

      public Image 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. 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

      public Image 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

      public byte getPixelAsInt8(VectorUInt32 idx)
    • getPixelAsUInt8

      public short getPixelAsUInt8(VectorUInt32 idx)
    • getPixelAsInt16

      public short getPixelAsInt16(VectorUInt32 idx)
    • getPixelAsUInt16

      public int getPixelAsUInt16(VectorUInt32 idx)
    • getPixelAsInt32

      public int getPixelAsInt32(VectorUInt32 idx)
    • getPixelAsUInt32

      public long getPixelAsUInt32(VectorUInt32 idx)
    • getPixelAsInt64

      public int getPixelAsInt64(VectorUInt32 idx)
    • getPixelAsUInt64

      public long getPixelAsUInt64(VectorUInt32 idx)
    • getPixelAsFloat

      public float getPixelAsFloat(VectorUInt32 idx)
    • getPixelAsDouble

      public double getPixelAsDouble(VectorUInt32 idx)
    • getPixelAsVectorInt8

      public VectorInt8 getPixelAsVectorInt8(VectorUInt32 idx)
    • getPixelAsVectorUInt8

      public VectorUInt8 getPixelAsVectorUInt8(VectorUInt32 idx)
    • getPixelAsVectorInt16

      public VectorInt16 getPixelAsVectorInt16(VectorUInt32 idx)
    • getPixelAsVectorUInt16

      public VectorUInt16 getPixelAsVectorUInt16(VectorUInt32 idx)
    • getPixelAsVectorInt32

      public VectorInt32 getPixelAsVectorInt32(VectorUInt32 idx)
    • getPixelAsVectorUInt32

      public VectorUInt32 getPixelAsVectorUInt32(VectorUInt32 idx)
    • getPixelAsVectorInt64

      public VectorInt64 getPixelAsVectorInt64(VectorUInt32 idx)
    • getPixelAsVectorUInt64

      public VectorUInt64 getPixelAsVectorUInt64(VectorUInt32 idx)
    • getPixelAsVectorFloat32

      public VectorFloat getPixelAsVectorFloat32(VectorUInt32 idx)
    • getPixelAsVectorFloat64

      public VectorDouble getPixelAsVectorFloat64(VectorUInt32 idx)
    • getPixelAsComplexFloat32

      public SWIGTYPE_p_std__complexT_float_t getPixelAsComplexFloat32(VectorUInt32 idx)
    • getPixelAsComplexFloat64

      public SWIGTYPE_p_std__complexT_double_t getPixelAsComplexFloat64(VectorUInt32 idx)
    • setPixelAsInt8

      public void setPixelAsInt8(VectorUInt32 idx, byte v)
    • setPixelAsUInt8

      public void setPixelAsUInt8(VectorUInt32 idx, short v)
    • setPixelAsInt16

      public void setPixelAsInt16(VectorUInt32 idx, short v)
    • setPixelAsUInt16

      public void setPixelAsUInt16(VectorUInt32 idx, int v)
    • setPixelAsInt32

      public void setPixelAsInt32(VectorUInt32 idx, int v)
    • setPixelAsUInt32

      public void setPixelAsUInt32(VectorUInt32 idx, long v)
    • setPixelAsInt64

      public void setPixelAsInt64(VectorUInt32 idx, int v)
    • setPixelAsUInt64

      public void setPixelAsUInt64(VectorUInt32 idx, long v)
    • setPixelAsFloat

      public void setPixelAsFloat(VectorUInt32 idx, float v)
    • setPixelAsDouble

      public void setPixelAsDouble(VectorUInt32 idx, double v)
    • setPixelAsVectorInt8

      public void setPixelAsVectorInt8(VectorUInt32 idx, VectorInt8 v)
    • setPixelAsVectorUInt8

      public void setPixelAsVectorUInt8(VectorUInt32 idx, VectorUInt8 v)
    • setPixelAsVectorInt16

      public void setPixelAsVectorInt16(VectorUInt32 idx, VectorInt16 v)
    • setPixelAsVectorUInt16

      public void setPixelAsVectorUInt16(VectorUInt32 idx, VectorUInt16 v)
    • setPixelAsVectorInt32

      public void setPixelAsVectorInt32(VectorUInt32 idx, VectorInt32 v)
    • setPixelAsVectorUInt32

      public void setPixelAsVectorUInt32(VectorUInt32 idx, VectorUInt32 v)
    • setPixelAsVectorInt64

      public void setPixelAsVectorInt64(VectorUInt32 idx, VectorInt64 v)
    • setPixelAsVectorUInt64

      public void setPixelAsVectorUInt64(VectorUInt32 idx, VectorUInt64 v)
    • setPixelAsVectorFloat32

      public void setPixelAsVectorFloat32(VectorUInt32 idx, VectorFloat v)
    • setPixelAsVectorFloat64

      public void setPixelAsVectorFloat64(VectorUInt32 idx, VectorDouble v)
    • setPixelAsComplexFloat32

      public void setPixelAsComplexFloat32(VectorUInt32 idx, SWIGTYPE_p_std__complexT_float_t v)
    • setPixelAsComplexFloat64

      public void setPixelAsComplexFloat64(VectorUInt32 idx, SWIGTYPE_p_std__complexT_double_t v)
    • getBufferAsByteBuffer

      public ByteBuffer 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()