[Insight-users] Indexing itk::Image
motes motes
mort.motes at gmail.com
Sun Aug 23 17:14:18 EDT 2009
As I understand pixels in an image is located using a indexType:
// 2D case:
IndexType idx;
idx[0] = 3;
idx[1] = 4;
ImageType::Pointer image = reader->GetOutPut(); // from some reader.
image->GetPixel(idx);
The above example get the value of the pixel at location (3,4) in the image.
But in the itk::Image.h file it says:
*
* The data in an image is arranged in a 1D array as [][][][slice][row][col]
* with the column index varying most rapidly. The Index type reverses
* the order so that with Index[0] = col, Index[1] = row, Index[2] = slice,
* ...
I don't understand this notation:
[][][][slice][row][col]
does it mean that if I do:
image[0];
I get the first whole column of the image? And what does the prefix
[][][]...stand for?
//Example:
In the BSplineDeformableTransform images m_WrappedImage and
m_CoefficientImage are used like this:
PixelType * dataPointer = const_cast<PixelType *>((
m_InputParametersPointer->data_block() ));
unsigned int numberOfPixels = m_GridRegion.GetNumberOfPixels();
for ( unsigned int j = 0; j < SpaceDimension; j++ ) {
m_WrappedImage[j]->GetPixelContainer()->SetImportPointer(
dataPointer, numberOfPixels );
dataPointer += numberOfPixels;
m_CoefficientImage[j] = m_WrappedImage[j];
}
To my understanding this first sets the column of m_WrappedImage to
the first half of the parameters and then copies that to the
m_CoefficientImage. Next the last half of the parameters are copied to
the row of m_WrappedImage and then copied to m_CoefficientImage. But I
am pretty sure this is not what goes on, what does:
m_CoefficientImage[0]
m_CoefficientImage[1]
actually mean for the 2D case?
More information about the Insight-users
mailing list