[Insight-users] itkTriangleMeshToImageBinaryFilter error
Guillaume Cazoulat
guillaume.cazoulat at wanadoo.fr
Tue Nov 4 11:51:55 EST 2008
Hello Leila,
I solved the problem by replacing my vtk version (5.0) to the cvs one.
Guillaume
>
>
> I will take a look when I get a chance from work
>
> Leila
> On Wed, 2008-10-29 at 20:02 +0100, Guillaume Cazoulat wrote:
>> Hello Leila,
>>
>> Thanks for your reply. I can run the test examples without any problem
>> but I get the error below when trying to convert my mesh which is
>> initially a vtkPolyData (I attached it)). On some machines in my lab (but
>> not the most) there is no error. Very strange.
>>
>> Code :
>>
>> vtkPolyDataToitkMesh* converter = new vtkPolyDataToitkMesh;
>> converter->SetInput(input);
>>
>> cout << "with " << converter->GetOutput()->GetNumberOfPoints() << "
>> points";
>> cout << "and " << converter->GetOutput()->GetNumberOfCells() << "
>> cells." << endl;
>> cout << "Bounding Box: " <<
>> converter->GetOutput()->GetBoundingBox()->GetBounds() << endl;
>>
>> typedef itk::DefaultDynamicMeshTraits TriangleMeshTraits;
>> typedef itk::Mesh TriangleMeshType;
>>
>> double Origin[3];
>> Origin[0] = -50;
>> Origin[1] = -250;
>> Origin[2] = -100;
>>
>> typedef itk::Image< unsigned short, 3 > ImageType;
>> ImageType::SizeType size;
>> size[0] = 200;
>> size[1] = 200;
>> size[2] = 200;
>>
>> itk::TriangleMeshToBinaryImageFilter::Pointer filter =
>> itk::TriangleMeshToBinaryImageFilter::New();
>> filter->SetInput(converter->GetOutput());
>> filter->SetOrigin(Origin);
>> //filter->SetSpacing(Spacing);
>> filter->SetSize(size);
>> //filter->SetTolerance(0.0);
>> //filter->UpdateOutputInformation();
>> filter->Update();
>>
>>
>> Result :
>>
>> with 15716 pointsand 31428 cells.
>> Bounding Box: [-34.5676, 42.0997, -204.9, -147.198, -81, -27]
>> terminate called after throwing an instance of 'itk::ExceptionObject'
>> what():
>> /usr/local/include/InsightToolkit/BasicFilters/itkTriangleMeshToBinaryImageFilter.txx:484:
>> itk::ERROR: TriangleMeshToBinaryImageFilter(0x35e76b0): Point with id
>> 12884901889 does not exist in the new pointset
>> Aborted
>>
>>
>> With an old version of your filter (contained in ITK 3.2) the error
>> message is different :
>>
>> with 15716 pointsand 31428 cells.
>> Bounding Box: [-34.5676, 42.0997, -204.9, -147.198, -81, -27]
>> terminate called after throwing an instance of 'itk::ExceptionObject'
>> what():
>> /home/guillaume/These/TestITK/src/test/itkTriangleMeshToBinaryImageFilter.txx:230:
>> itk::ERROR: TriangleMeshToBinaryImageFilter(0x1236560): No Image Indices
>> Found.
>> Aborted
>>
>> Maybe the ouput of vtkPolyDataToitkMesh is not correct?
>>
>>
>>
>> Regards
>>
>> Guillaume
>>
>>
>> >
>> > I rechecked the code with the recent modifications and can not see the
>> > problem you are reporting.
>> >
>> > can you run the test examples
>> >
>> > Testing/Code/BasicFilters/itkTriangleMeshToBinaryImageFilterTest.cxx
>> > Testing/Code/BasicFilters/itkTriangleMeshToBinaryImageFilterTest2.cxx
>> >
>> > one thing I suggest is to make sure that the image is big enough that
>> > it
>> > can cover the mesh.
>> >
>> >
>> > Leila
>> >
>> > On Mon, 2008-10-27 at 19:06 +0100, Guillaume CAZOULAT wrote:
>> > > Hi!
>> > >
>> > > I had no problem to compile (gcc-4.2) and execute the following code
>> > > with itk 3.2:
>> > >
>> > > typedef float PixelType;
>> > > const unsigned int Dimension = 3;
>> > >
>> > > vtkPolyDataToitkMesh* converter = new vtkPolyDataToitkMesh;
>> > > converter->SetInput(input);
>> > >
>> > > typedef itk::Image< unsigned short, 3 > ImageType;
>> > > ImageType::SizeType size;
>> > > size[0] = Dim[0];
>> > > size[1] = Dim[1];
>> > > size[2] = Dim[2];
>> > > ImageType::IndexType start;
>> > > start[0] = 0;
>> > > start[1] = 0;
>> > > start[2] = 0;
>> > >
>> > > typedef itk::DefaultDynamicMeshTraits TriangleMeshTraits;
>> > > typedef itk::Mesh TriangleMeshType;
>> > >
>> > > itk::TriangleMeshToBinaryImageFilter::Pointer filter =
>> > > itk::TriangleMeshToBinaryImageFilter::New();
>> > > filter->SetInput(converter->GetOutput());
>> > > filter->SetOrigin(Origin);
>> > > filter->SetSpacing(Spacing);
>> > > filter->SetSize(size);
>> > > filter->SetTolerance(0.0);
>> > > filter->UpdateOutputInformation();
>> > > filter->Update();
>> > >
>> > >
>> > > but since I updated to 3.8 the following error occurs at execution :
>> > >
>> > > terminate called after throwing an instance of 'itk::ExceptionObject'
>> > > what():
>> > > /usr/local/include/InsightToolkit/BasicFilters/itkTriangleMeshToBinaryImageFilter.txx:484:
>> > > itk::ERROR: TriangleMeshToBinaryImageFilter(0x35e76b0): Point with id
>> > > 12884901889 does not exist in the new pointset
>> > > Aborted
>> > >
>> > > Would you know how to solve the problem?
>> > >
>> > > Thanks
>> > >
>> > > Guillaume
>> > >
>> > > _______________________________________________
>> > > Insight-users mailing list
>> > > Insight-users at itk.org
>> > > http://www.itk.org/mailman/listinfo/insight-users
>> >
>> >
>> >
>
>
>
More information about the Insight-users
mailing list