[Insight-users] LineSpatialObject: problem with applying a transformation

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 5 15:37:36 EDT 2007


Hi Hoveij,

Thanks for pointing this out.

My mistake, the TransformMeshFilter must be instantiated
over an itk::Mesh type, not over an itk::PointSet type.

The compilation problem that you encounter is the result
of the attempts that the filter makes for passing the
mesh topology from the input mesh to the output mesh.

You can get around this by using a itkMesh instead of
an itkPointSet.

Replacing your declaration in line 87:

    typedef itk::PointSet< PixelType, ImageDimension,
             DefaultStaticMeshTraitsType> PointSetType;


with

    typedef itk::Mesh< PixelType, ImageDimension,
             DefaultStaticMeshTraitsType> PointSetType;


should be enough.


Please let us know if you find any other problem.


    Thanks


       Luis


-----------------
Hoveijn, I wrote:
> Hi Luis,
> 
> Thanks again for your help. I followed your suggestions and loading
> points into an itkPointSet worked fine. Transforming the points using
> itkTransformMeshFilter turned out to be more challenging. So far I
> mostly got error messages.
> 
> As far as I can see at some point a type conflict occurs. My guess is
> that the coordinate representation type is defaulted to some type at
> several places. At least I found one in itkTransformMeshFilter.
> Therefore I introduced a DefaultStaticMeshTraitsType and in it a
> 'CoordinateRepType' which I set to 'double' or 'float'. Probably there
> is even more to it because the number of errors decreased but not
> enough. Combining CoordinateRepType with commenting and uncommenting the
> code snippet which should apply the transformation to the set of points,
> I got the following:
> 
> double     commented    0 errors
> double   uncommented   10 errors
> float      commented    3 errors
> float    uncommented    3 errors
> 
> The last two cases produced the same errors. The first case gave no
> errors but no transformation either. Below the errors are listed.
> Unfortunately the error messages are not very helpful. I will include my
> code with the transformation part commented. 
> 
> Yours, Igor
> 
> 
> 
> CoordinateRepType double
> ------------------------
> 
> ------ Build started: Project: deform2, Configuration: Release Win32
> ------
> Compiling...
> deform2.cpp
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(107) : error C2039: 'SetCellLinks' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
>  
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(60) : while compiling class template member function 'void
> itk::TransformMeshFilter<TInputMesh,TOutputMesh,TTransform>::GenerateDat
> a(void)'
>         with
>         [
>             TInputMesh=PointSetType,
>             TOutputMesh=PointSetType,
>             TTransform=TransformType
>         ]
>         .\deform2.cpp(316) : see reference to class template
> instantiation
> 'itk::TransformMeshFilter<TInputMesh,TOutputMesh,TTransform>' being
> compiled
>         with
>         [
>             TInputMesh=PointSetType,
>             TOutputMesh=PointSetType,
>             TTransform=TransformType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(107) : error C2039: 'GetCellLinks' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(109) : error C2039: 'SetCells' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(109) : error C2039: 'GetCells' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(110) : error C2039: 'SetCellData' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(110) : error C2039: 'GetCellData' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(113) : error C2039: 'MaxTopologicalDimension' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(113) : error C2065: 'MaxTopologicalDimension' : undeclared identifier
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(117) : error C2039: 'SetBoundaryAssignments' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> d:\applicaties\insighttoolkit\code\basicfilters\itkTransformMeshFilter.t
> xx(118) : error C2039: 'GetBoundaryAssignments' : is not a member of
> 'itk::PointSet<TPixelType,VDimension,TMeshTraits>'
>         with
>         [
>             TPixelType=PixelType,
>             VDimension=2,
>             TMeshTraits=DefaultStaticMeshTraitsType
>         ]
> Build log was saved at
> "file://d:\Igor\ITKapps\deform2\deform2.dir\Release\BuildLog.htm"
> deform2 - 10 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped
> ==========
> 
> 
> 
> 
> 
> 
> 
> CoordinateRepType float
> -----------------------
> 
> ------ Build started: Project: deform2, Configuration: Release Win32
> ------
> Compiling...
> deform2.cpp
> .\deform2.cpp(135) : error C2664:
> 'itk::ImageRegistrationMethod<TFixedImage,TMovingImage>::SetInterpolator
> ' : cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
> 'itk::InterpolateImageFunction<TInputImage,TCoordRep> *'
>         with
>         [
>             TFixedImage=FixedImageType,
>             TMovingImage=MovingImageType
>         ]
>         and
>         [
>  
> TObjectType=itk::LinearInterpolateImageFunction<MovingImageType,Coordina
> teRepType>
>         ]
>         and
>         [
>             TInputImage=itk::Image<PixelType,2>,
>  
> TCoordRep=itk::ImageToImageMetric<FixedImageType,MovingImageType>::Coord
> inateRepresentationType
>         ]
>         No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
> .\deform2.cpp(138) : error C2664:
> 'itk::ImageRegistrationMethod<TFixedImage,TMovingImage>::SetTransform' :
> cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
> 'itk::Transform<TScalarType,NInputDimensions,NOutputDimensions> *'
>         with
>         [
>             TFixedImage=FixedImageType,
>             TMovingImage=MovingImageType
>         ]
>         and
>         [
>  
> TObjectType=itk::BSplineDeformableTransform<CoordinateRepType,2,3>
>         ]
>         and
>         [
>  
> TScalarType=itk::ImageToImageMetric<FixedImageType,MovingImageType>::Coo
> rdinateRepresentationType,
>             NInputDimensions=2,
>             NOutputDimensions=2
>         ]
>         No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
> .\deform2.cpp(279) : error C2664:
> 'itk::ResampleImageFilter<TInputImage,TOutputImage>::SetTransform' :
> cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
> 'const itk::Transform<TScalarType,NInputDimensions,NOutputDimensions> *'
>         with
>         [
>             TInputImage=MovingImageType,
>             TOutputImage=FixedImageType
>         ]
>         and
>         [
>  
> TObjectType=itk::BSplineDeformableTransform<CoordinateRepType,2,3>
>         ]
>         and
>         [
>  
> TScalarType=itk::ImageToImageMetric<FixedImageType,MovingImageType>::Coo
> rdinateRepresentationType,
>             NInputDimensions=2,
>             NOutputDimensions=2
>         ]
>         No user-defined-conversion operator available that can perform
> this conversion, or the operator cannot be called
> Build log was saved at
> "file://d:\Igor\ITKapps\deform2\deform2.dir\Release\BuildLog.htm"
> deform2 - 3 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped
> ==========
> 
> ########################################################################
> ###################################################################
> 
> 
> 
> 
> 
> 
> 
> 
> -----Oorspronkelijk bericht-----
> Van: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
> Verzonden: zaterdag 31 maart 2007 22:57
> Aan: Hoveijn, I
> CC: Insight Users
> Onderwerp: Re: [Insight-users] LineSpatialObject: problem with applying
> a transformation
> 
> 
> Hi Igor,
> 
> Thanks for your clarification.
> 
> If you have the coordinates of the original points, what you could do is
> to load these points into an itkPointSet.
> 
> Then, you can use the itkMeshTransformFilter in oder to apply the
> transformation to all the points.
> 
> Please look at the DataRepresentation chapter of the ITK Software Guide
> for a description on how to set the points of a PointSet.
> 
> 
>     Regards,
> 
> 
>        Luis
> 
> 
> ----------------
> Hoveijn, I wrote:
> 
>>Hi Luis,
>>
>>Thanks very much for your reply. Maybe I did not make myself clear.
>>
>>The problem is not visualization of a transformed line. Given the 
>>transformation I wish to transform a contour, which is given as an 
>>ordered set of points. In my application I need the coordinates of the
> 
> 
>>points of the transformed contour. I tried to collect the points in a 
>>LineSpatialObject and then apply the transformation to this object. 
>>That resulted in an error at compile time.
>>
>>I would be happy to feed the points separately to the transformation, 
>>but the nearest I could find in the ItkSoftwareGuide is the 
>>LineSpatialObject.
>>
>>I will include my code as well as the error message.
>>
>>Yours,
>>
>>Igor
>>
>>
>>
>>
>>-----Oorspronkelijk bericht-----
>>Van: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>>Verzonden: vrijdag 23 maart 2007 19:46
>>Aan: Hoveijn, I
>>CC: insight-users at itk.org
>>Onderwerp: Re: [Insight-users] LineSpatialObject: problem with 
>>applying a transformation
>>
>>
>>Hi Igor,
>>
>>
>>If your line is only 1-pixel wide, it can easily get lost in the 
>>interpolation and the transformation of point locations through the 
>>BSPlineDeformableTransform.
>>
>>You may want to use a very thick line, or a pattern that fills in the 
>>entire image.
>>
>>For examples on how to visualize the effect of deformable 
>>registration, please look at the ITK Software Guide.
>>
>>     http://www.itk.org/ItkSoftwareGuide.pdf
>>
>>
>>in particular to section 8.15 "Visualizing Deformation Fields" in 
>>pdf-pages 501-508.
>>
>>
>>    Regards,
>>
>>
>>
>>       Luis
>>
>>
>>
>>-------------------
>>Hoveijn, I wrote:
>>
>>
>>>Dear ITK-users,
>>>
>>>I am using BSplineDeformableTransform to find a transformation form 
>>>one image to another. Then I would like to use the transformation to 
>>>map a line in the first image to a line in the second image. By 
>>>analogy I cut and pasted the code below. Everything works fine except 
>>>transforming the line. Please let me know if more details are needed.
>>>I would be grateful if someone could help me.
>>>
>>>Remark. The header of the procedure may look strange. This code is 
>>>compiled and linked into a dll file and then called form Matlab.
>>>
>>>Igor Hoveijn
>>>
>>>
>>
> 
> 
> De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de geadresseerde(n). Anderen dan de geadresseerde mogen geen gebruik maken van dit bericht, het openbaar maken of op enige wijze verspreiden of vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor een incomplete aankomst of vertraging van dit verzonden bericht.
> 
> The contents of this message are confidential and only intended for the eyes of the addressee(s). Others than the addressee(s) are not allowed to use this message, to make it public or to distribute or multiply this message in any way. The UMCG cannot be held responsible for incomplete reception or delay of this transferred message.


More information about the Insight-users mailing list