Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends

cmtk::ScalarImage Class Reference
[cmtkBase Library]

Two-dimensional image with scalar pixel values. More...

#include <cmtkScalarImage.h>

Collaboration diagram for cmtk::ScalarImage:
Collaboration graph
[legend]

List of all members.

Public Types

typedef ScalarImage Self
 This class.
typedef SmartPointer< SelfSmartPtr
 Smart pointer to ScalarImage.
typedef SmartConstPointer< SelfSmartConstPtr
 Smart pointer to const ScalarImage.
typedef Region< 2, int > RegionType
 Region type.
typedef RegionType::IndexType IndexType
 Pixel index type.
typedef FixedVector
< 3, Types::Coordinate
SpaceVectorType
 Space vector type.

Public Member Functions

 ScalarImage ()
 Default constructor creates empty image.
 ScalarImage (const int dimsx, const int dimsy, const int numberOfFrames=1)
 Constructor with separate x and y dimensions.
 ScalarImage (const ScalarImage &source, const int *roiFrom=NULL, const int *roiTo=NULL)
 Get ROI as sub-image.
 ScalarImage (const ScalarImage &other, const Self::RegionType &roi)
 Get ROI as sub-image.
virtual ~ScalarImage ()
 Virtual destructor.
virtual void SetDims (const Self::IndexType &dims)
 Set dimensions.
const Self::IndexType GetDims () const
 Get dimensions.
virtual ScalarImageInterpolateFrom (const ScalarImage *grid, const CoordinateMatrix3x3 *matrix, const cmtk::Interpolators::InterpolationEnum interpolation=cmtk::Interpolators::LINEAR) const
 Interpolate sub-image with affine transformation.
void SetROI (const Self::RegionType &roi)
 Set region of interest.
void UnsetROI ()
 Clear region of interest.
virtual ScalarImageGetCropped () const
 Return cropped copy of this image.
void CreatePixelData (const ScalarDataType dtype)
 Create pixel data array with given data type.
void SetImageOrigin (const Self::SpaceVectorType &imageOrigin)
 Set image origin.
Self::SpaceVectorType GetImageOrigin (const int frame=0) const
 Get image origin of given frame (default: 0).
 cmtkGetSetMacro (Self::SpaceVectorType, ImageDirectionX)
 Direction of image rows relative to ImageOrigin.
 cmtkGetSetMacro (Self::SpaceVectorType, ImageDirectionY)
 Direction of image columns relative to ImageOrigin.
 cmtkGetSetMacro (Types::Coordinate, ImageSlicePosition)
 Image position from coordinate origin along axial direction.
 cmtkGetSetMacro (Types::Coordinate, ImageTiltAngle)
 Image tilt with respect to axial position.
int GetNumberOfPixels () const
 Get number of pixels.
Types::DataItem GetPixelAt (const int i, const int j) const
 Get pixel at 2-D index.
bool GetPixelAt (Types::DataItem &value, const Types::Coordinate i, const Types::Coordinate j) const
 Get pixel at fractional 2-D index by bilinear interpolation.
bool GetPixelAtCubic (Types::DataItem &value, const Types::Coordinate i, const Types::Coordinate j) const
 Get pixel at fractional 2-D index by bicubic interpolation.
void SetPixelAt (const int i, const int j, const Types::DataItem data)
 Set pixel at 2-D index.
virtual ScalarImageClone () const
 Clone (duplicate) this object.
virtual ScalarImageClone (const bool clonePixelData)
 Clone (duplicate) this object.
ScalarImageDownsample (const int factorX, int factorY=0, ScalarImage *const target=NULL) const
 Create downsampled copy of this image.
virtual void ApplyBinaryMask (const ScalarImage *maskImage, const bool invert=false)
 Apply binary mask to image.
void Mirror (const bool horizontal, const bool vertical)
 Mirror image horizontally and/or vertically.
void AdjustAspect (const bool interpolate=false)
 Adjust aspect ratio.
void AdjustToIsotropic (const Types::Coordinate pixelSize, const bool interpolate=false)
 Adjust aspect ratio.
void ProjectPixel (const Self::SpaceVectorType &v, int &i, int &j) const
 Project 3D coordinate onto image plane.
ScalarImageoperator-= (const ScalarImage &)
 Subtract one image from another in place.
virtual void Print () const
 Print object information.
Image filter operators.

These functions perform various filter operations on the image data.

For each filter, two functions are implemented: GetXXXFiltered and ApplyXXXFilter. The former returns a pointer to a newly allocated pixel data array that contains the filtered data. The latter replaces the current object's pixel data with the filtered data.

Note:
A complete new ScalarImage object with filtered pixel data can easily and efficiently be created by calling object->Clone( false )->ApplyXXXFilter().
TypedArray::SmartPtr GetMedianFiltered (const byte range) const
 Return median-filtered image data.
ScalarImageApplyMedianFilter (const byte range)
 Replace pixel data with median-filtered data.
TypedArray::SmartPtr GetGaussFiltered (const Types::Coordinate stdDev) const
 Return Gauss-filtered (smoothed) image data.
ScalarImageApplyGaussFilter (const Types::Coordinate stdDev)
 Replace pixel data with Gauss-filtered data.
TypedArray::SmartPtr GetSobel2DFiltered () const
 Return Sobel-filtered (edge-enhanced) image data.
ScalarImageApplySobel2DFilter ()
 Replace pixel data with Sobel-filtered data.
TypedArray::SmartPtr GetLaplace2DFiltered () const
 Return Laplace-filtered (edge-enhanced) image data.
ScalarImageApplyLaplace2DFilter ()
 Replace pixel data with Laplace-filtered data.
TypedArray::SmartPtr GetSobelFiltered (const bool horizontal, const bool absolute=false) const
 Return Sobel-filtered (edge-enhanced) image data.
ScalarImageApplySobelFilter (const bool horizontal, const bool absolute=false)
 Replace pixel data with 1-D Sobel-filtered data.

Public Attributes

Self::SpaceVectorType m_ImageOrigin
 Origin of image in world coordinates.

Private Member Functions

 cmtkGetSetMacro (int, NumberOfFrames)
 Number of image frames for multi-frame images.
 cmtkGetSetMacro (TypedArray::SmartPtr, PixelData)
 Pixel data.
 cmtkGetSetMacro2Array (Types::Coordinate, PixelSize)
 Pixel spacing.
 cmtkGetSetMacro (Types::Coordinate, FrameToFrameSpacing)
 Frame-to-frame spacing.
TypedArray::SmartPtr GetFilteredData (const std::vector< Types::DataItem > &filterX, const std::vector< Types::DataItem > &filterY) const
void AdjustAspectY (const bool interpolate=false)
 Adjust aspect ratio by stretching in Y-direction.
void AdjustAspectX (const bool interpolate=false)
 Adjust aspect ratio by stretching in X-direction.

Private Attributes

Self::IndexType m_Dims
 Image dimensions.
Self::RegionType ROI
 Cropping region of interest.
bool HasROI
 Flag for validity of ROI.

Friends

ScalarImageoperator- (const ScalarImage &, const ScalarImage &)
 Subtract one image from another.

Detailed Description

Two-dimensional image with scalar pixel values.

Definition at line 60 of file cmtkScalarImage.h.


Member Typedef Documentation

Pixel index type.

Definition at line 88 of file cmtkScalarImage.h.

Region type.

Definition at line 85 of file cmtkScalarImage.h.

This class.

Definition at line 76 of file cmtkScalarImage.h.

Smart pointer to const ScalarImage.

Definition at line 82 of file cmtkScalarImage.h.

Smart pointer to ScalarImage.

Definition at line 79 of file cmtkScalarImage.h.

Space vector type.

Definition at line 91 of file cmtkScalarImage.h.


Constructor & Destructor Documentation

virtual cmtk::ScalarImage::~ScalarImage (  ) [inline, virtual]

Virtual destructor.

Definition at line 117 of file cmtkScalarImage.h.


Member Function Documentation

cmtk::ScalarImage::cmtkGetSetMacro ( int  ,
NumberOfFrames   
) [private]

Number of image frames for multi-frame images.

cmtk::ScalarImage::cmtkGetSetMacro ( Types::Coordinate  ,
ImageSlicePosition   
)

Image position from coordinate origin along axial direction.

This field is only meaningful if this 2D image is part of a 3D image.

cmtk::ScalarImage::cmtkGetSetMacro ( Types::Coordinate  ,
FrameToFrameSpacing   
) [private]

Frame-to-frame spacing.

cmtk::ScalarImage::cmtkGetSetMacro ( Types::Coordinate  ,
ImageTiltAngle   
)

Image tilt with respect to axial position.

This field is only meaningful if this is an axial 2D image that is part of a 3D image.

cmtk::ScalarImage::cmtkGetSetMacro ( TypedArray::SmartPtr  ,
PixelData   
) [private]

Pixel data.

cmtk::ScalarImage::cmtkGetSetMacro ( Self::SpaceVectorType  ,
ImageDirectionX   
)

Direction of image rows relative to ImageOrigin.

cmtk::ScalarImage::cmtkGetSetMacro ( Self::SpaceVectorType  ,
ImageDirectionY   
)

Direction of image columns relative to ImageOrigin.

cmtk::ScalarImage::cmtkGetSetMacro2Array ( Types::Coordinate  ,
PixelSize   
) [private]

Pixel spacing.

void cmtk::ScalarImage::CreatePixelData ( const ScalarDataType  dtype ) [inline]

Create pixel data array with given data type.

Definition at line 160 of file cmtkScalarImage.h.

Referenced by Downsample(), InterpolateFrom(), and cmtk::ScalarImageIO::ReadAnalyze().

virtual ScalarImage* cmtk::ScalarImage::GetCropped (  ) const [inline, virtual]

Return cropped copy of this image.

Definition at line 151 of file cmtkScalarImage.h.

const Self::IndexType cmtk::ScalarImage::GetDims (  ) const [inline]
int cmtk::ScalarImage::GetNumberOfPixels (  ) const [inline]
Types::DataItem cmtk::ScalarImage::GetPixelAt ( const int  i,
const int  j 
) const [inline]

Get pixel at 2-D index.

Definition at line 204 of file cmtkScalarImage.h.

virtual void cmtk::ScalarImage::SetDims ( const Self::IndexType dims ) [inline, virtual]

Set dimensions.

Definition at line 120 of file cmtkScalarImage.h.

void cmtk::ScalarImage::SetImageOrigin ( const Self::SpaceVectorType imageOrigin ) [inline]
void cmtk::ScalarImage::SetPixelAt ( const int  i,
const int  j,
const Types::DataItem  data 
) [inline]

Set pixel at 2-D index.

Definition at line 225 of file cmtkScalarImage.h.

Referenced by Downsample().

void cmtk::ScalarImage::SetROI ( const Self::RegionType roi ) [inline]

Set region of interest.

Definition at line 138 of file cmtkScalarImage.h.

void cmtk::ScalarImage::UnsetROI (  ) [inline]

Clear region of interest.

Definition at line 145 of file cmtkScalarImage.h.


Friends And Related Function Documentation

ScalarImage* operator- ( const ScalarImage image0,
const ScalarImage image1 
) [friend]

Subtract one image from another.

Definition at line 722 of file cmtkScalarImage.cxx.


Member Data Documentation

bool cmtk::ScalarImage::HasROI [private]

Flag for validity of ROI.

Definition at line 361 of file cmtkScalarImage.h.

Referenced by ScalarImage().

Origin of image in world coordinates.

Definition at line 167 of file cmtkScalarImage.h.

Referenced by Clone(), GetImageOrigin(), Mirror(), and Print().

Cropping region of interest.

Definition at line 358 of file cmtkScalarImage.h.

Referenced by ScalarImage().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines