[Insight-users] creating 1 voxel image not possible?
Luis Ibanez
luis.ibanez at kitware.com
Wed May 26 13:45:18 EDT 2010
Hi Maarten,
Thanks for your detailed question.
I tried your code, and...
It works for me
See the full code below.
I compiled it in Ubuntu Linux 9.10,
with Gcc 4.4, and the CVS version of ITK.
It compiled without errors and ran without
crashing.
It is likely that you have a configuration
problem in your build.
Have you run the program in a debugger ?
Regards,
Luis
--------------------------------------------------------
#include "itkImage.h"
#include "itkMatrix.h"
int main()
{
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 );
return 0;
}
-------------------------------------------------------------------
On Tue, May 25, 2010 at 12:53 PM, Maarten Beek <beekmaarten at yahoo.com>wrote:
> 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
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100526/3ebab7d9/attachment-0001.htm>
More information about the Insight-users
mailing list