[Insight-users] compilation error in DiscreteCurvatureEstimator
Martine Lefevre
martine_lef at yahoo.fr
Tue Feb 24 11:09:04 EST 2009
Yes I have built itk with itk_use_Review on
the previous problem was due to the use of class QEMeshScalarDataVTKPolyDataWriter. I replaced it by QuadEdgeMeshScalarDataVTKPolyDataWriter and the problem was resolved.
Another question regarding the sphere data in the folder data, this data is a surface which can be use as input for curvature estimation. Am I right?
Thank you
--- En date de : Mar 24.2.09, Arnaud Gelas <arnaud_gelas at hms.harvard.edu> a écrit :
De: Arnaud Gelas <arnaud_gelas at hms.harvard.edu>
Objet: Re: compilation error in DiscreteCurvatureEstimator
À: "martine_lef at yahoo.fr" <martine_lef at yahoo.fr>
Cc: "insight itk" <insight-users at itk.org>, "Luis Ibanez" <luis.ibanez at kitware.com>
Date: Mardi 24 Février 2009, 15h00
Hi Martine,
DiscreteCurvatureEstimators are now in Insight/Code/Review directory. To be
able to use it, you need to build itk with ITK_USE_REVIEW ON.
Could you try to copy the code from
Insight/Testing/Code/Review/itkQuadEdgeMeshGaussianCurvatureTest.cxx into your
project, please?
You would only need to change itkQuadEdgeMeshGaussianCurvatureTest by main,
then it should normally work.
If you face any problem, just let me know.
Arnaud
Martine Lefevre wrote:
> Hi Arnauld and thank you for your suggestions.
> I have followed what you have suggested, now I have no link problem but I
got a compilation error. I use your c++ code DiscreteCurvatureEstimator Which I
have download from the Insight journal link.
> A/s soon as I instantiate an object of the class
/QEMeshScalarDataVTKPolyDataWriter(the line: WriterType::Pointer writer =
WriterType::New();)/ I get the following error:/
> / /
>
> Compiling...
>
> 1>3Dfeatures.cxx
>
>
1>c:\mycodes\3dfeatures\itkQEMeshScalarDataVTKPolyDataWriter.h(115)
: error C2440: 'initializing' : cannot convert from 'const
itk::MapContainer<TElementIdentifier,TElement> *' to
'itk::SmartPointer<TObjectType>'
>
> 1> with
>
> 1> [
>
> 1>
TElementIdentifier=itk::QuadEdgeMeshExtendedTraits<CoordType,3,2,CoordType,CoordType,CoordType,bool,bool>::PointIdentifier,
>
> 1> TElement=double
>
> 1> ]
>
> 1> and
>
> 1> [
>
> 1>
TObjectType=itk::MapContainer<itk::QuadEdgeMeshExtendedTraits<CoordType,3,2,CoordType,CoordType,CoordType,bool,bool>::PointIdentifier,double>
>
> 1> ]
>
> 1> No constructor could take the source type, or constructor
overload resolution was ambiguous
>
> 1>
c:\mycodes\3dfeatures\itkQEMeshScalarDataVTKPolyDataWriter.h(114) :
while compiling class template member function 'void
itk::QEMeshScalarDataVTKPolyDataWriter<TMesh>::WritePointData(void)'
>
> 1> with
>
> 1> [
>
> 1> TMesh=MeshType
>
> 1> ]
>
> 1> ..\3Dfeatures.cxx(106) : see reference to class template
instantiation 'itk::QEMeshScalarDataVTKPolyDataWriter<TMesh>'
being compiled
>
> 1> with
>
> 1> [
>
> 1> TMesh=MeshType
>
> 1> ]
>
> 1>Build log was saved at
"file://c:\mycodes\3DFeatures\Bin\3Dfeatures.dir\Debug\BuildLog.htm"
>
> 1>3Dfeatures - 1 error(s), 0 warning(s)
>
> ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped
==========
>
> Thank you for your time
> Martine.
> I paste my code here
>
>
> //curvature estimation using tkQEMeshDiscreteGaussianCurvatureEstimator
>
>
> #include "itkQuadEdgeMesh.h"
>
> #include "itkVTKPolyDataReader.h"
>
>
> #include "itkQuadEdgeMeshExtendedTraits.h"
>
> #include "itkQEMeshDiscreteGaussianCurvatureEstimator.h"
>
> #include "itkQEMeshDiscreteMeanCurvatureEstimator.h"
>
> #include "itkQEMeshDiscreteMinCurvatureEstimator.h"
>
> #include "itkQEMeshDiscreteMaxCurvatureEstimator.h"
>
> #include "itkQEMeshScalarDataVTKPolyDataWriter.h"
>
>
> int main( )
>
> {
>
>
> int Curv_choice=0;
>
> /* std::cout <<" * 0: Gaussian"
<<std::endl;
>
> std::cout <<" * 1: mean" <<std::endl;
>
> std::cout <<" * 2: min" <<std::endl;
>
> std::cout <<" * 3: max" <<std::endl; */
>
>
> const unsigned int Dimension = 3;
>
> typedef double CoordType;
>
>
> typedef itk::QuadEdgeMeshExtendedTraits <CoordType, Dimension, 2,
CoordType, CoordType, CoordType, bool, bool > Traits;
>
>
> typedef itk::QuadEdgeMesh< CoordType, Dimension, Traits >
MeshType;
>
> typedef
itk::QEMeshDiscreteGaussianCurvatureEstimator<MeshType,MeshType>
GaussianCurvatureFilterType;
>
> typedef
itk::QEMeshDiscreteMeanCurvatureEstimator<MeshType,MeshType>
MeanCurvatureFilterType;
>
> typedef
itk::QEMeshDiscreteMinCurvatureEstimator<MeshType,MeshType>
MinCurvatureFilterType;
>
> typedef
itk::QEMeshDiscreteMaxCurvatureEstimator<MeshType,MeshType>
MaxCurvatureFilterType;
>
>
> typedef itk::VTKPolyDataReader< MeshType > ReaderType;
ReaderType::Pointer reader = ReaderType::New( );
>
>
>
> reader->SetFileName( "C:/Images/sphere.vtk");
>
> 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;
>
> }
>
>
>
>
>
> MeshType::Pointer mesh = reader->GetOutput();
>
>
> GaussianCurvatureFilterType::Pointer gaussian_curvature =
GaussianCurvatureFilterType::New();
>
> MeanCurvatureFilterType::Pointer mean_curvature =
MeanCurvatureFilterType::New();
>
> MinCurvatureFilterType::Pointer min_curvature =
MinCurvatureFilterType::New();
>
> MaxCurvatureFilterType::Pointer max_curvature =
MaxCurvatureFilterType::New();
>
>
>
> MeshType::Pointer output;
>
> std::string output_filename;
>
>
> switch(Curv_choice)
>
> {
>
> case 0:
>
> gaussian_curvature->SetInput( mesh );
>
> gaussian_curvature->Update();
>
>
> output = gaussian_curvature->GetOutput();
>
> output_filename = "gaussian_curvature..vtk";
>
> break;
>
> case 1:
>
> mean_curvature->SetInput( mesh );
>
> mean_curvature->Update();
>
>
> output = mean_curvature->GetOutput();
>
> output_filename = "mean_curvature.vtk";
>
> break;
>
> case 2:
>
> min_curvature->SetInput( mesh );
>
> min_curvature->Update();
>
>
> output = min_curvature->GetOutput();
>
> output_filename = "min_curvature.vtk";
>
> break;
>
> case 3:
>
> max_curvature->SetInput( mesh );
>
> max_curvature->Update();
>
>
> output = max_curvature->GetOutput();
>
> output_filename = "max_curvature.vtk";
>
> break;
>
> default:
>
> std::cout <<"The second parameter should be in between 0
and 3"
>
> <<std::endl;
>
> return EXIT_FAILURE;
>
> }
>
>
> typedef itk::QEMeshScalarDataVTKPolyDataWriter< MeshType >
WriterType;
>
> WriterType::Pointer writer = WriterType::New();
>
> writer->SetInput( output );
>
> writer->SetFileName( output_filename );
>
> writer->Update();
>
>
> return EXIT_SUCCESS;
>
> }
>
>
>
> --- En date de : *Lun 23.2.09, Arnaud Gelas
/<arnaud_gelas at hms.harvard.edu>/* a écrit :
>
> De: Arnaud Gelas <arnaud_gelas at hms.harvard.edu>
> Objet: Re: [Insight-users] link error: cannot open file
> 'ITKReview.lib'
> À: "martine_lef at yahoo.fr" <martine_lef at yahoo.fr>
> Cc: "insight itk" <insight-users at itk.org>, "Luis
Ibanez"
> <luis.ibanez at kitware.com>
> Date: Lundi 23 Février 2009, 14h51
>
> Dear Martine,
>
> There is no library for ITKReview (Note that you can see all generated
> libraries your BUILD_DIRECTORY/bin/ ), you should link instead with
> ITKQuadEdgeMesh since you want to use the QuadEdgeMeshDataStructure.
> Then, in your main you should use itk::QuadEdgeMesh instead of
itk::Mesh, if
> you want to estimate curvatures...
>
> You can find examples/tests in Testing/Code/Review directory:
>
> * itkQuadEdgeMeshGaussianCurvatureTest.cxx
> * itkQuadEdgeMeshMeanCurvatureTest.cxx
> * itkQuadEdgeMeshMaxCurvatureTest.cxx
> * itkQuadEdgeMeshMinCurvatureTest.cxx
>
> Have a good day,
> Arnaud
>
> Martine Lefevre wrote:
> > Dear Luis and itk users,
> > > I try to do some curvature estimation using the filter
proposed by Gelas
> Arnauld which is based on a surface mesh data structure
itk::QuadEdgeMesh. For
> this reason I include the ITKReview in my CMakeLists file. >
In building the project I get the following link error:
> > > 1>Linking...
> > > 1> LINK : fatal error LNK1104: cannot open file
> 'ITKReview.lib'
> > > Do you know the cause of this error?
> > Thank you in advance
> > Martine
> > I paste the code here and the CMakeLists file.
> > > > > > # This project is designed
to be built outside the Insight source tree..
> > > > PROJECT(Curvature)
> > > > > FIND_PACKAGE ( ITK)
> > > IF ( ITK_FOUND)
> > > INCLUDE( ${USE_ITK_FILE} )
> > > ENDIF( ITK_FOUND)
> > > > FIND_PACKAGE ( VTK)
> > > IF ( VTK_FOUND)
> > > INCLUDE( ${USE_VTK_FILE} )
> > > ENDIF( VTK_FOUND)
> > > > ADD_EXECUTABLE(Curvature Curvature.cxx)
> > > TARGET_LINK_LIBRARIES(Curvature ITKBasicFilters
ITKReview ITKSpatialObject
> ITKNumerics ITKIO ITKCommon ITKAlgorithms vtkRendering
vtkVolumeRendering vtkIO
> vtkWidgets vtkGraphics vtkImaging vtkFiltering vtkCommon)
> > > > > > > // surface
extraction with itk: itkBinaryMask3DMeshSource
> > > // SurfaceExtraction.cxx
> > > > #include "itkImageFileReader.h"
> > > #include "itkBinaryMask3DMeshSource.h"
> > > #include "itkImage.h"
> > > #include "itkMesh.h"
> > > > //#include "itkQuadEdgeMesh.h"
> > > > int main(void )
> > > {
> > > const unsigned int Dimension = 3;
> > > //typedef unsigned char PixelType;
> > > typedef float PixelType;
> > > > typedef itk::Image< PixelType, Dimension
> ImageType;
> > > typedef itk::ImageFileReader< ImageType >
ReaderType;
> > > ReaderType::Pointer reader = ReaderType::New();
> > >
reader->SetFileName("C:/Images/Volume.hdr"); > >
> 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>( 255.0);
> > > > meshSource->SetObjectValue( objectValue
);
> > > meshSource->SetInput( reader->GetOutput() );
> > > > try
> > > {
> > > meshSource->Update();
> > > }
> > > catch( itk::ExceptionObject & exp )
> > > {
> > > std::cerr << "Exception thrown during
Update() "
> << std::endl;
> > > std::cerr << exp << std::endl;
> > > return EXIT_FAILURE;
> > > }
> > > > std::cout << "Nodes = "
<<
> meshSource->GetNumberOfNodes() << std::endl;
> > > std::cout << "Cells = " <<
> meshSource->GetNumberOfCells() << std::endl;
> > > std::cout << "Code end !" <<
std::endl;
> > > std::cin.get();
> > > return EXIT_SUCCESS;
> > > }
> > > > >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090224/464e6d43/attachment-0001.htm>
More information about the Insight-users
mailing list