[Insight-users] 4D Bspline approximation

Nicholas Tustison ntustison at gmail.com
Mon Oct 1 20:12:03 EDT 2012


Hi Mathieu,

I think I got something working.  The main difference between
what you had and what needed to be changed was the specification
of the spacing, origin, and size of both the bspline filter and the 
transform.  The spacing, origin, and size specify the parametric 
domain *not* the b-spline control point lattice.  The latter gets calculated
automatically internal to the classes.

Let me know if you have any questions,
Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testRegulItkBspline.cxx
Type: application/octet-stream
Size: 7191 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121001/7b1f1372/attachment.obj>
-------------- next part --------------



On Sep 26, 2012, at 11:00 AM, Nicholas Tustison <ntustison at gmail.com> wrote:

> You're right.  Thanks for that.  I've got a couple deadlines
> I have to prioritize this week but I'm going to try to get to this 
> this weekend.   I have it on my to-do list.
> 
> Nick
> 
> 
> On Sep 25, 2012, at 12:23 PM, "DE CRAENE, MATHIEU" <mathieu.de_craene at philips.com> wrote:
> 
>> Hi Nick
>> 
>> 
>> It seems you have a linking problem so it might be that one cmake line misses some libraries.
>> Here is my CMakeLists.txt:
>> 
>> ====================================================
>> cmake_minimum_required(VERSION 2.8)
>> 
>> PROJECT( test-regult-itk-bspline )
>> 
>> FIND_PACKAGE(VTK REQUIRED)
>> INCLUDE(${VTK_USE_FILE})
>> 
>> FIND_PACKAGE(ITK REQUIRED)
>> INCLUDE(${ITK_USE_FILE})
>> 
>> ADD_EXECUTABLE(testRegulItkBspline testRegulItkBspline.cxx)
>> TARGET_LINK_LIBRARIES (testRegulItkBspline ${ITK_LIBRARIES} ${VTK_LIBRARIES})
>> 
>> ====================================================
>> 
>> 
>> I am using VTK 5.8 and ITK 4.2.
>> 
>> 
>> Thanks a lot for trying to compile this.
>> 
>> 
>> 
>> Math
>> 
>> 
>> -----Message d'origine-----
>> De : Nicholas Tustison [mailto:ntustison at gmail.com] 
>> Envoyé : vendredi 21 septembre 2012 19:06
>> À : DE CRAENE, MATHIEU
>> Cc : Insight-users at itk.org Users
>> Objet : Re: [Insight-users] 4D Bspline approximation
>> 
>> Hi Mathieu,
>> 
>> I'm having some difficulty compiling your code (see below).  
>> Considering the errors, I'm wondering if I'm compiling against the right version of VTK.  Also, what version of ITK are you using?
>> 
>> Nick
>> 
>> 
>> [ntustison at Nietzschean-Numerics Fri Sep 21 12:58:48] $ make testRegulItkBspline Scanning dependencies of target testRegulItkBspline [100%] Building CXX object CMakeFiles/testRegulItkBspline.dir/testRegulItkBspline.o
>> In file included from /Users/ntustison/Pkg/Utilities/src/testRegulItkBspline.cxx:4:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Filtering/vtkUnstructuredGrid.h:27:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Filtering/vtkPointSet.h:29:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Filtering/vtkDataSet.h:40:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Filtering/vtkDataObject.h:35:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Common/vtkObject.h:41:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Common/vtkObjectBase.h:43:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Common/vtkIndent.h:24:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Common/vtkSystemIncludes.h:40:
>> In file included from /Users/ntustison/Pkg/ANTS/bin/VTK/Common/vtkIOStream.h:112:
>> In file included from /usr/include/c++/4.2.1/backward/strstream:51:
>> /usr/include/c++/4.2.1/backward/backward_warning.h:32:2: warning: This file includes at least one deprecated or antiquated header. Please consider using one of the 32
>>     headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of
>>     the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. [-W#warnings] #warning This file includes at least one deprecated or antiquated header. \  ^
>> 1 warning generated.
>> Linking CXX executable testRegulItkBspline Undefined symbols for architecture x86_64:
>> "vtkDataSet::GetBounds(double*)", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*)", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkSmartPointerBase::vtkSmartPointerBase(vtkSmartPointerBase const&)", referenced from:
>>     _main in testRegulItkBspline.o
>>     std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<vtkSmartPointer<vtkUnstructuredGrid>*, std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > > >, vtkSmartPointer<vtkUnstructuredGrid> const&) in testRegulItkBspline.o
>> "vtkSmartPointerBase::~vtkSmartPointerBase()", referenced from:
>>     _main in testRegulItkBspline.o
>>     std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<vtkSmartPointer<vtkUnstructuredGrid>*, std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > > >, vtkSmartPointer<vtkUnstructuredGrid> const&) in testRegulItkBspline.o
>> "vtkSmartPointerBase::operator=(vtkSmartPointerBase const&)", referenced from:
>>     std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<vtkSmartPointer<vtkUnstructuredGrid>*, std::vector<vtkSmartPointer<vtkUnstructuredGrid>, std::allocator<vtkSmartPointer<vtkUnstructuredGrid> > > >, vtkSmartPointer<vtkUnstructuredGrid> const&) in testRegulItkBspline.o
>> "vtkUnstructuredGrid::New()", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkUnstructuredGridReader::New()", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkUnstructuredGridReader::GetOutput()", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkUnstructuredGridWriter::New()", referenced from:
>>     _main in testRegulItkBspline.o
>> "vtkWriter::SetInput(vtkDataObject*)", referenced from:
>>     _main in testRegulItkBspline.o
>> ld: symbol(s) not found for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>> make[3]: *** [testRegulItkBspline] Error 1
>> make[2]: *** [CMakeFiles/testRegulItkBspline.dir/all] Error 2
>> make[1]: *** [CMakeFiles/testRegulItkBspline.dir/rule] Error 2
>> make: *** [testRegulItkBspline] Error 2
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Sep 20, 2012, at 12:55 PM, "DE CRAENE, MATHIEU" <mathieu.de_craene at philips.com> wrote:
>> 
>>> Hi Nick
>>> 
>>> Thanks a lot for the input.
>>> 
>>> For the first point, I understand that what matters is the domain as defined from (Origin,Size,Spacing) since I don't want to generate an output image but only the phi lattice. For the second point, I have removed my border control points since this is internally handled.
>>> 
>>> When debugging further the code, I noticed the following
>>> 
>>> 1) The origin of the lattice as obtained from the bspline projection 
>>> filter seems to be
>>> 
>>>                              latticeOrigin = -latticeSpacing.
>>> When I would expect it to be
>>>                              latticeOrigin = domainOrigin -latticeSpacing.
>>> 
>>> Is it assumed  that the origin of the domain is 0 ?
>>> 
>>> 2) When I use a time lower bound equal to the Upper bound equal to 0, I get infinite displacement.
>>> 
>>> 3) As a test, I overwrote the result of the projection filter and set all node values to be equal to 10. I was expecting the mesh to be shifted from a constant translation at each time step. But it seems to be moving only at the first time point. Maybe I incorrectly defined the temporal span of the transformation ....
>>> 
>>> I reattach the source code to this email. I'm using  ITK 4.2.
>>> Since this part of the toolkit is under intense development, I maybe should move to a more recent version. Let me know where to download it if that would be the case.
>>> 
>>> 
>>> Thanks a lot!!!!
>>> 
>>> 
>>> Mathieu
>>> 
>>> -----Message d'origine-----
>>> Envoyé : jeudi 20 septembre 2012 13:38 À : DE CRAENE, MATHIEU Objet : 
>>> Re: 4D Bspline approximation
>>> 
>>> Hi Mathieu,
>>> 
>>> Perhaps answering your short questions will help us figure out what's going on.
>>> 
>>>> - Is it correct to use the same size as the number of control points in itkBSplineScatteredDataPointSetToImageFilter ?
>>> 
>>> No, they're distinct.  The spacing and size combination define the sampled parametric domain (I did this primarily since the filter derives from the PointSetToImageFilter base class).  So if I have a 20x20 control point grid defining a b-spline object over a domain of 100mm x 100mm, there are many ways I can define the domain which won't matter for the internal calculations of the final "PhiLattice".
>>> For example, a size and spacing combination of
>>> 
>>> size = 101, spacing = 1
>>> 
>>> will define the same parametric domain as
>>> 
>>> size = 1001, spacing = 0.1
>>> 
>>> The only difference will be the size of the "image", i.e. sampled B-spline object when you call GetOutput() but the GetPhiLattice() will be the same.
>>> 
>>>> - Should I take care of having enough border control points around the mesh nodes (padding) ? How many nodes ?
>>> 
>>> In the B-spline classes that I've written (including a rewrite of the B-spline transform class), I don't make a distinction between the internal control points and the border control points.  When you specify the parametric domain for the BSplineScattered...Filter (by specifying the origin, size, and spacing), the control points get laid out automatically based on that domain and the spline order(s) including the border ones.
>>> 
>>> I hope that helps.  Let me know if it doesn't and I can try running things on my end.
>>> 
>>> Nick
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ________________________________
>>> The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
>>> <testRegulItkBspline.cxx>_____________________________________
>>> 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.php
>>> 
>>> 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
>> 
>> 
> 



More information about the Insight-users mailing list