[Insight-users] Surface extraction seg. fault at
meshSource->Update()
Luis Ibanez
luis.ibanez at kitware.com
Tue May 1 06:36:08 EDT 2007
Hi Catherine,
BTW, If your final goal is to actually extract surfaces
out of a *Series* of DICOM files, then what you may consider
to do first is to use the
SeriesImageReader
To load all the DICOM slices into a single 3D Volume.
You will find instructions on how to do this in the
ITK Software Guide:
http://www.itk.org/ItkSoftwareGuide.pdf
in the Chapter "Reading and Writing Images".
Once you have a 3D volume into an itk::Image, you will be
able to use the mesh3D extraction filter,
or as a second option
You could also convert the 3D volume to a vtkImageData and
then use the vtkContour filter.
Please let us know what your final goal actually is.
Thanks
Luis
------------------------
Catherine Peloquin wrote:
> My image only contains one slice. It has 512 rows and 512 columns.
>
> Catherine
>
>
> On 4/30/07, *Luis Ibanez* <luis.ibanez at kitware.com
> <mailto:luis.ibanez at kitware.com>> wrote:
>
>
> Hi Catherine,
>
> Does your image CT0001.dcm contain multiple slices ?
>
>
> Otherwise it is going to be considered as a 1 slice
> 3D image, and it is reasonable that it will fail to
> produce a 3D surface when passed as input to the
> BinaryMask3DMeshSource.
>
>
> Please let us know how many pixels along each one
> of the three dimensions does CT0001.dcm has.
>
>
>
> Regards,
>
>
> Luis
>
>
>
> --------------------------
> Catherine Peloquin wrote:
> > I am trying to get a version of the example surface extraction code
> > running. I had problems with the CMakeLists.txt file, but that
> has been
> > resolved. My problem now is that I am getting a segmentation
> fault at
> > the line "meshSource->Update()". I tried using .ima files, and .dcm
> > files located in the same directory as my .cxx and CMakeLists
> files. I
> > added a try/catch block around this line as Luis suggested and
> re-built
> > the example, but the program still faults out at that location. I am
> > running the executable with the command "SurfaceExtraction CT0001.dcm
> > 400".
> >
> > The relevant .cxx file code is as follows:
> >
> > //Surface Extraction code modified from ITK Surface Extraction
> Example
> > included in ITK build
> > #if defined(_MSC_VER)
> > #pragma warning ( disable : 4786 )
> > #endif
> >
> > #ifdef __BORLANDC__
> > #define ITK_LEAN_AND_MEAN
> > #endif
> >
> > #include "itkImageFileReader.h"
> > #include " itkBinaryMask3DMeshSource.h"
> > #include " itkImage.h"
> > #include "itkMesh.h"
> > #include <iostream>
> > using namespace std;
> >
> > int main(int argc, char * argv[] )
> > {
> >
> > if( argc < 3 )
> > {
> > std::cerr << "Usage: IsoSurfaceExtraction inputImageFile
> > objectValue " << std::endl;
> > return EXIT_FAILURE;
> > }
> >
> > const unsigned int Dimension = 3;
> > typedef unsigned char PixelType;
> >
> > typedef itk::Image< PixelType, Dimension > ImageType;
> > typedef itk::ImageFileReader< ImageType > ReaderType;
> > ReaderType::Pointer reader = ReaderType::New();
> > reader->SetFileName( argv[1] );
> >
> > try
> > {
> > reader->Update();
> > }
> > catch( itk::ExceptionObject & exp )
> > {
> > std::cerr << "Exception thrown while reading the input file " <<
> > std::endl;
> > std::cerr << exp << std::endl;
> > return EXIT_FAILURE;
> > }
> >
> > typedef itk::Mesh<double> MeshType;
> > typedef itk::BinaryMask3DMeshSource< ImageType, MeshType >
> > MeshSourceType;
> > MeshSourceType::Pointer meshSource = MeshSourceType::New();
> >
> > const PixelType objectValue = static_cast<PixelType>( atof(
> argv[2] ) );
> >
> > meshSource->SetObjectValue( objectValue );
> >
> > cout << "Before meshSource input set." << endl;
> > try
> > {
> > meshSource->SetInput( reader->GetOutput() );
> > }
> > catch( itk::ExceptionObject & exp )
> > {
> > std::cerr << "Exception thrown during setting mesh
> input() " <<
> > std::endl;
> > std::cerr << exp << std::endl;
> > return EXIT_FAILURE;
> > }
> >
> > cout << "Before meshSource update" << endl;
> > try
> > {
> > meshSource->Update(); //--------------------------SEGMENTATION
> > FAULT HERE--------------------------------------------
> > }
> > catch( itk::ExceptionObject & exp )
> > {
> > cerr << "Exception thrown during Update() " << std::endl;
> > cerr << exp << std::endl;
> > return EXIT_FAILURE;
> > }
> >
> > cout << "Nodes = " << meshSource->GetNumberOfNodes() << std::endl;
> > cout << "Cells = " << meshSource->GetNumberOfCells() << std::endl;
> >
> > return EXIT_SUCCESS;
> > }
> >
> > Does anyone have any suggestions?
> >
> > Thanks,
> > Catherine
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org <mailto:Insight-users at itk.org>
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list