[Insight-developers] an itkImage "Hello world"
Damion Shelton
dmsst59+@pitt.edu
Fri, 13 Apr 2001 13:25:24 -0400
Hi all...
As requested here's the code for the "hello world" equivalent that I use to
test out our BloxImage class:
int main()
{
unsigned long imagesize[] = {10,10,10};
unsigned long spacing[] = {1,1,1};
typedef itk::BloxImage<itk::BloxPixel,3> Blox3D;
Blox3D::Pointer image = itk::BloxImage<itk::BloxPixel,3>::New();
Blox3D::SizeType size = {{0}};
size.SetSize( imagesize );
Blox3D::RegionType largestPossibleRegion;
largestPossibleRegion.SetSize( size );
image->SetLargestPossibleRegion( largestPossibleRegion );
image->Allocate();
return 1;
}
It would be *really* handy to have a simpler way of handling creation of
images. Keep in mind that the above code doesn't set index or pixel spacing,
so a full instantiation of the image class would require another 5-10 lines
of code.
Others have expressed concern that requiring this quantity of code for what
should be the simplest (or one of the simplest) operations in ITK can be
frustrating to new users. Any thoughts....?
-Damion-