[Insight-users] Question about resampling and warping

Rosario Sance rsance at die.upm.es
Thu Feb 23 13:46:29 EST 2006


Hi again,

Thanks for your answer, it was quite useful for me.
Even so, I have further comments:

1) The 'Cut' option improves my examination, but it seems not to be enough. 
The code I am using to generate the Deformation Field is the following:
..........
if( argc >= 7 )
     {

     typedef itk::Vector< float, Dimension >  VectorType;
     typedef itk::Image< VectorType, Dimension >  DeformationFieldType;

     DeformationFieldType::Pointer field = DeformationFieldType::New();
     field->SetRegions( fixedImageReader->GetOutput()->GetBufferedRegion()  );
     field->SetOrigin( fixedImage->GetOrigin() );
     field->SetSpacing( fixedImage->GetSpacing() );
     field->Allocate();

     typedef itk::ImageRegionIterator< DeformationFieldType > FieldIterator;
     FieldIterator fi( field, 
fixedImageReader->GetOutput()->GetBufferedRegion()  );

     fi.GoToBegin();

     TransformType::InputPointType  fixedPoint;
     TransformType::OutputPointType movingPoint;
     DeformationFieldType::IndexType index;

     VectorType displacement;

     while( ! fi.IsAtEnd() )
       {
       index = fi.GetIndex();
       field->TransformIndexToPhysicalPoint( index, fixedPoint );
       movingPoint = transform1->TransformPoint( fixedPoint );
       displacement[0] = movingPoint[0] - fixedPoint[0];
       displacement[1] = movingPoint[1] - fixedPoint[1];
       displacement[2] = movingPoint[2] - fixedPoint[2];
       fi.Set( displacement );
       ++fi;
       }

     typedef itk::ImageFileWriter< DeformationFieldType >  FieldWriterType;
     FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
     fieldWriter->SetInput( field );
     fieldWriter->SetFileName( argv[6] );
     try
       {
       fieldWriter->Update();
       }
     catch( itk::ExceptionObject & excp )
       {
       std::cerr << "Exception thrown " << std::endl;
       std::cerr << excp << std::endl;
       return EXIT_FAILURE;
       }
     }
..........

But all I get is an aleatory net of arrows, without clear tendency, even 
when the real deformation applied does show one, which I have checked with 
the SquaredDifferenceImageFilter and the resulting visualization. Is it 
reasonable?

2) If the Histogram Matching filter compensate the intensities, it seems to 
be reason enough for the algorithm to work. What I don´t reach to 
understand, is how does the Warping Filter work after the registration 
filter. I mean, if it stores the deformation, when applied over the 
original moving image, (not the matched one), shouldn´t it generate the 
registered image with a registered position but the previous intensities. 
Why does also the image intensities change?

3) Actually the scale factor I am obliged to use is approximately 1e-30, 
since the vector values are enormous, both for the Resampling and Warping 
filters. So of course I´m able to see the vectors, but they don´t look like 
a field. I´m afraid that I´m doing something wrong, isn´t it?

Thanks a lot.
Regards,

Rosario


At 17:50 20/02/2006, Luis Ibanez wrote:

>Hi Rosario,
>
>Thanks for the detailed description of your problem.
>
>Please find some comments below:
>
>1) For visualizing a 3D deformation field, you may want
>    to keep using ParaView but before adding Glyphs to the
>    vector field, extract a slice from the field by using
>    the "Cut" filter.
>
>    In this way you will be able to move the slice back
>    and forth, as well as change its orientation, and then
>    see the vectors on that slice.  This will prevent vectors
>    from other planes to occlude the ones that you are trying
>    to examine.
>
>
>
>2) The Demons registration method may still work with your
>    images, as long as you use the Histogram Matching filter
>    before passing the images to the Demons registration filter.
>
>    The Histogram Matching filter is actually compensating
>    for the intensity differences between your images.
>
>
>
>3) It is very likely that the reason why you don't see anything
>    on the deformation field produced by the Demons filter is that
>    the vector are too small.  You can easily verify this assumption
>    by using the Scale option that ParaView offers in the Glyph menu
>
>    This option will be in the "Parameters" tab, on the "Orient/Scale"
>    frame, and with the title:   "Scale Factor".
>
>    Try setting a larger value in this scale factor, and let us know
>    if that makes your vectors visible.
>
>
>
>
>    Thanks
>
>
>
>       Luis
>
>
>
>------------------
>Rosario Sance wrote:
>>Hi everybody,
>>I´m dealing with a project of motion correction in 3D DCE-MRI series. Up 
>>to now, I´ve tried several elastic registration algorithms, using MI and 
>>different optimizers, and aplying multirresolution strategies. Since 
>>there are intensity changes in my series along the time, I think that the 
>>most appropriate approach is to use multimodality methods, in spite of I 
>>only work with MRI.
>>Every suggestion of my previous work will welcomed.
>>Now, my questions:
>>1) When I define a BSpline grid and obtain a transform from the 
>>registration process, I achieve the registered image using the 
>>itk::ResampleImageFilter 
>><http://www.itk.org/Doxygen/html/itkResampleImageFilter_8h-source.html>. 
>>But since I´m working with 3D and respiratory motion, I have some 
>>difficulties in visualizing the deformation field and interpreting it. I 
>>have tried with the Glyph option of the Paraview tool. Would you 
>>recommend me another way?
>>2) I have also tried the code of 
>>Examples/Registration/DeformableRegistration2.cxx and 
>>Examples/Registration/DeformableRegistration5.cxx, so I have checked the 
>>possibilities of  the DemonsRegistrationFilter and the 
>>LevelSetMotionRegistrationFilter. In principle it should not work because 
>>the dependence with the voxel intensity and the histogram, but I got 
>>surprised because these algorithms reached a good registration outcomes, 
>>correcting the position of the input images. However:
>>         - The resampled image looks absolutely fine about the position, 
>> but not about the intensities, which seem to be adapted/very similar to 
>> those in the reference image. Actually I am taking the spacing and 
>> origin of the fixed image, but since I´m applying the output of the 
>> warping filter on the moving image, shouldn´t be kept the intensities 
>> and corrected only the position? I can´t understand how does the warping 
>> filter works, in spite I have searched in the documentation...
>>         - On the other hand, I write the deformation field as an image 
>> of vectors from the output of the warping filter, and keep it in a .vtk 
>> file. But when I try to visualize it as I did with the deformation 
>> fields of the resample filter, I don´t get to see any field. How does 
>> this filter store the vectors field and could it been visualized? Which 
>> are the differences between the use of both of the filters?
>>Thanks a lot in advance.
>>Rosario
>>
>>Rosario Sance Garzón
>>Dpto. Ingeniería Electrónica
>>E.T.S.I. Telecomunicación
>>Avda. Ciudad Universitaria s/n
>>E-28040 - Madrid (SPAIN)
>>___________________________________________________
>>
>>------------------------------------------------------------------------
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>
>



Rosario Sance Garzón
Dpto. Ingeniería Electrónica
E.T.S.I. Telecomunicación
Avda. Ciudad Universitaria s/n
E-28040 - Madrid (SPAIN)
___________________________________________________  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060223/39f20045/attachment.htm


More information about the Insight-users mailing list