Two-dimensional image with scalar pixel values. More...
#include <cmtkScalarImage.h>
Public Types | |
typedef ScalarImage | Self |
This class. | |
typedef SmartPointer< Self > | SmartPtr |
Smart pointer to ScalarImage. | |
typedef SmartConstPointer< Self > | SmartConstPtr |
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 ScalarImage * | InterpolateFrom (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 ScalarImage * | GetCropped () 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 ScalarImage * | Clone () const |
Clone (duplicate) this object. | |
virtual ScalarImage * | Clone (const bool clonePixelData) |
Clone (duplicate) this object. | |
ScalarImage * | Downsample (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. | |
ScalarImage & | operator-= (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.
| |
TypedArray::SmartPtr | GetMedianFiltered (const byte range) const |
Return median-filtered image data. | |
ScalarImage * | ApplyMedianFilter (const byte range) |
Replace pixel data with median-filtered data. | |
TypedArray::SmartPtr | GetGaussFiltered (const Types::Coordinate stdDev) const |
Return Gauss-filtered (smoothed) image data. | |
ScalarImage * | ApplyGaussFilter (const Types::Coordinate stdDev) |
Replace pixel data with Gauss-filtered data. | |
TypedArray::SmartPtr | GetSobel2DFiltered () const |
Return Sobel-filtered (edge-enhanced) image data. | |
ScalarImage * | ApplySobel2DFilter () |
Replace pixel data with Sobel-filtered data. | |
TypedArray::SmartPtr | GetLaplace2DFiltered () const |
Return Laplace-filtered (edge-enhanced) image data. | |
ScalarImage * | ApplyLaplace2DFilter () |
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. | |
ScalarImage * | ApplySobelFilter (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 | |
ScalarImage * | operator- (const ScalarImage &, const ScalarImage &) |
Subtract one image from another. |
Two-dimensional image with scalar pixel values.
Definition at line 60 of file cmtkScalarImage.h.
Pixel index type.
Definition at line 88 of file cmtkScalarImage.h.
typedef Region<2,int> cmtk::ScalarImage::RegionType |
Region type.
Definition at line 85 of file cmtkScalarImage.h.
typedef ScalarImage cmtk::ScalarImage::Self |
This class.
Definition at line 76 of file cmtkScalarImage.h.
Smart pointer to const ScalarImage.
Definition at line 82 of file cmtkScalarImage.h.
typedef SmartPointer<Self> cmtk::ScalarImage::SmartPtr |
Smart pointer to ScalarImage.
Definition at line 79 of file cmtkScalarImage.h.
Space vector type.
Definition at line 91 of file cmtkScalarImage.h.
virtual cmtk::ScalarImage::~ScalarImage | ( | ) | [inline, virtual] |
Virtual destructor.
Definition at line 117 of file cmtkScalarImage.h.
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] |
Get dimensions.
Definition at line 126 of file cmtkScalarImage.h.
Referenced by cmtk::VolumeFromSlices::CheckImage(), cmtk::ScalarImageSimilarity::CheckImageDimensions(), cmtk::ScalarImageSimilarity::GetPatternIntensity(), cmtk::ScalarImageSimilarity::GetRegionalMutualInformation(), cmtk::VolumeFromSlices::InitSequence(), cmtk::DICOM::Read(), cmtk::Image::SetFromScalarImage(), cmtk::PGM::Write(), cmtk::PGM::Write16bit(), and cmtk::ScalarImageIO::WriteAnalyze().
int cmtk::ScalarImage::GetNumberOfPixels | ( | ) | const [inline] |
Get number of pixels.
Definition at line 198 of file cmtkScalarImage.h.
Referenced by cmtk::ScalarImageSimilarity::GetGradientDifference(), cmtk::operator-(), cmtk::PGM::Write(), and cmtk::PGM::Write16bit().
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] |
Set image origin.
Definition at line 170 of file cmtkScalarImage.h.
Referenced by Clone(), Downsample(), cmtk::UniformVolume::GetOrthoSlice(), cmtk::UniformVolume::GetOrthoSliceInterp(), cmtk::Image::GetScalarImage(), and cmtk::DICOM::Read().
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.
ScalarImage* operator- | ( | const ScalarImage & | image0, |
const ScalarImage & | image1 | ||
) | [friend] |
Subtract one image from another.
Definition at line 722 of file cmtkScalarImage.cxx.
bool cmtk::ScalarImage::HasROI [private] |
Flag for validity of ROI.
Definition at line 361 of file cmtkScalarImage.h.
Referenced by ScalarImage().
Self::IndexType cmtk::ScalarImage::m_Dims [private] |
Image dimensions.
Definition at line 355 of file cmtkScalarImage.h.
Referenced by AdjustAspectX(), AdjustAspectY(), Clone(), GetGaussFiltered(), GetLaplace2DFiltered(), GetMedianFiltered(), GetSobel2DFiltered(), GetSobelFiltered(), InterpolateFrom(), Mirror(), cmtk::operator-(), Print(), and ScalarImage().
Origin of image in world coordinates.
Definition at line 167 of file cmtkScalarImage.h.
Referenced by Clone(), GetImageOrigin(), Mirror(), and Print().
Self::RegionType cmtk::ScalarImage::ROI [private] |
Cropping region of interest.
Definition at line 358 of file cmtkScalarImage.h.
Referenced by ScalarImage().