[Insight-users] creating 1 voxel image not possible?

Maarten Beek beekmaarten at yahoo.com
Tue May 25 12:53:36 EDT 2010


Hi all,

I am trying to create a one voxel image (that will grow depending on the number of steps in the algorithm) using to following code:
    const unsigned int Dimension = 3;
    typedef itk::Matrix<double, 4, 4> MatrixType;
    typedef itk::Image<MatrixType, Dimension> MatrixFieldType;
    MatrixFieldType::Pointer matrixfield = MatrixFieldType::New();
    MatrixFieldType::IndexType index;
    index.Fill( 0 );
    MatrixFieldType::SizeType size;
    size.Fill( 1 );
    MatrixFieldType::RegionType region( index, size );
    matrixfield->SetRegions( region );
    matrixfield->Allocate();
    MatrixType matrix;
    matrix.SetIdentity();
    matrixfield->SetPixel( index, matrix );
However this code crashes.
When I fill size with 2's, the code seems to work.

Any ideas? Maarten



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100525/b0d29933/attachment.htm>


More information about the Insight-users mailing list