Converting INRimage simulation code to ITK¶
Image definition¶
The file heimdali/itkhelper.hxx defines the type of an image.
- typedef float PixelFloat
- const unsigned int ImageDimension
All images are 3-dimensional.
- typedef itk::VectorImage< PixelFloat, ImageDimension > ImageFloat
Images are 3-dimensionial, of size (nz, ny, nx).
Images contains nx * ny * nx pixels, and each pixel is a vector of nv value of type float.
nz | Number of planes |
ny | Number of rows |
nx | Number of columns |
nv | Number of values per pixel |
Internally, the image is stored in a continous block of memory, ie is a float*.
Building¶
Proving command line interface¶
Creating image¶
- ImageFloat::Pointer CreateImage(unsigned int nx, unsigned int ny, unsigned int nz = 1, unsigned int nv = 1)
itkhelper.hxx defines the CreateImage function to create an image in the temporary program memory. It does not do any persistant operation on the disk.
For example:
Heimdali::ImageFloat::Pointer image = Heimdali::CreateImage(5,5,5,2);
create a image of 3-dimensional image with 5 planes, 5 rows and 5 columns, where is value is a vector of 2 floats.
The following code:
Heimdali::ImageFloat::Pointer image = Heimdali::CreateImage(5,5);
create a image of 3-dimensional image with 1 planes, 5 rows and 5 columns, where is value is a vector of 1 float.
See the file createInputImage.cxx for a running example.