[Insight-users] 2D deformable registration

Luis Ibanez luis.ibanez@kitware.com
Wed May 19 20:10:16 EDT 2004


Hi Ping,


Please do the following:


1) Go to

        http://www.paraview.org

    download and intall the binary
    version of ParaView corresponding
    to your system.


2) Run ParaView and load your deformation
    field. (It must be in MetaImage format).


3) Use the Probes in ParaView in order
    to check if your deformation field
    has any values different from zero.



It looks like your deformation field
is being generated with zero values
or at least, very low values. Note
that the values of the deformation
field vectors are in physical units,
not pixels, therefore you have to
interpret them in the context of the
pixel spacing in your image.



Please let us know what you find.



   Thanks.



     Luis




---------------
ping chen wrote:

> Hi Luis,
> 
> I just CVS Insight yesterday and reinstall the
> Insight, I Compile the code with the newly installed
> ITK, the warped image is still the same as input
> image. do you have any suggestions? Thanks.
> 
> -Ping 
> 
> 
> 
> 
> --- Luis Ibanez <luis.ibanez@kitware.com> wrote:
> 
>>Hi Ping,
>>
>>A quick question before we go into details...
>>
>>Did you tried this process with a CVS updated
>>*this week*  ?
>>
>>A bug was recently found in the process of
>>reading Vector images. The effect is that
>>when reading an image of vectors, such as a
>>deformation field, all the pixels turned out
>>to be null. This bug was fixed at the end
>>of last week.
>>
>>If you are using a version with this bug,
>>your deformation field is being set as null
>>vectors in memory and therefore is not
>>applying *any* deformation to your  data.
>>
>>Please try updating your CVS checkout and
>>let us know if you continue experiencing
>>any problems.
>>
>>
>>   Thanks,
>>
>>
>>      Luis
>>
>>
>>
>>-------------------
>>ping chen wrote:
>>
>>>Hi Luis, 
>>>
>>>I try to use the deformation field to warp a
>>
>>image. i
>>
>>>use the deformation field generated by
>>>DeformableRegistration1.cxx, in which displacement
>>
>>for
>>
>>>x and displacement for y are both generated, also
>>
>>a
>>
>>>vector displacement image
>>
>>VectorDeformationField.mhd
>>
>>>is generated. 
>>>
>>>the 1st way for me to use the generated x y
>>>displacement, i use itkCompose2DVectorImageFilter
>>
>>to
>>
>>>combine x displacement and y displacement into a
>>>vector image. and then use this vector image to
>>
>>set
>>
>>>the deformation field for the warper. 
>>>
>>>the problem with this way is that the warped
>>
>>result
>>
>>>from this way is different from the warped image
>>
>>from
>>
>>>the DeformableRegistration1.cxx, though similiar. 
>>>
>>>the 2nd way, i just generated the imagereader to
>>>directly read VectorDeformationField.mhd, and then
>>
>>use
>>
>>>this reader output to set the deformation field of
>>
>>the
>>
>>>warper.
>>>
>>>the problem with this way is that this method
>>
>>didnt
>>
>>>work. the output of warper is exactly the same as
>>
>>the
>>
>>>moving image. 
>>>
>>>below is part of the code: the 1st way
>>>typedef itk::Compose2DVectorImageFilter<
>>>              
>>
>>InputImageType,DeformationFieldType>
>>
>>>FilterType;
>>> FilterType::Pointer filter = FilterType::New();
>>> filter->SetInput1(inputreader1->GetOutput());
>>> filter->SetInput2(inputreader1->GetOutput());
>>> filter->Update();
>>>  warper->SetInterpolator( interpolator );
>>>  warper->SetOutputSpacing(
>>>towarpreader->GetOutput()->GetSpacing() );
>>>  warper->SetOutputOrigin(
>>>towarpreader->GetOutput()->GetOrigin() );
>>>  warper->SetDeformationField( filter->GetOutput()
>>
>>);
>>
>>>  warper->SetInput( towarpreader->GetOutput() );
>>>  	try
>>>    {
>>>       warper->Update();
>>>    }
>>>
>>>the 2nd way:
>>>typedef itk::Vector< float, 2 >   
>>
>>VectorPixelType;
>>
>>>typedef itk::Image<  VectorPixelType, 2 >
>>>DeformationFieldType;
>>>typedef itk::ImageFileReader< DeformationFieldType
>>>
>>>FieldReaderType;
>>>typedef itk::WarpImageFilter<
>>>                          InputImageType, 
>>>                          InputImageType,
>>>                          DeformationFieldType  > 
>>
>>  
>>
>>>WarperType;
>>>  warper->SetInput( towarpreader->GetOutput() );
>>>  	try
>>>    {
>>>       warper->Update();
>>>    }
>>>WarperType::Pointer warper = WarperType::New();
>>>  InterpolatorType::Pointer interpolator =
>>>InterpolatorType::New();
>>>  warper->SetInterpolator( interpolator );
>>>  warper->SetOutputSpacing(
>>>towarpreader->GetOutput()->GetSpacing() );
>>>  warper->SetOutputOrigin(
>>>towarpreader->GetOutput()->GetOrigin() );
>>> 
>>>
>>
> warper->SetDeformationField(fieldreader1->GetOutput());
> 
>>>  warper->SetInput( towarpreader->GetOutput() );
>>>  	try
>>>    {
>>>       warper->Update();
>>>    }
>>>
>>>I cant figure out why  the warped result from 1way
>>
>>is
>>
>>>different from the warped result from
>>>DeformableRegistration1.cxx, and why the 2nd way
>>>doesnt work. do you have any suggestions? Thanks.
>>>
>>>-Ping 
>>>
>>>
>>>--- ping chen <miw2k@yahoo.com> wrote:
>>>
>>>
>>>>Hi Luis, 
>>>>
>>>>your suggestion is right. and 3d deformable
>>>>registration works great. 
>>>>
>>>>I have one question. is there any example which
>>>>shows
>>>>how to use the written displacement field, instead
>>>>of
>>>>using X->GetDeformationField()? 
>>>>after I finished the registration with
>>>>deformableregistration1.cxx and saved the
>>>>displacement
>>>>field, I still want to use the displacement field
>>
>>to
>>
>>>>warp new regions. it there any way i can avoid
>>
>>doing
>>
>>>>the registration again, and just use the
>>>>displacement
>>>>field directly? 
>>>>
>>>>Thanks,
>>>>Ping 
>>>>
>>>>
>>>>--- Luis Ibanez <luis.ibanez@kitware.com> wrote:
>>>>
>>>>
>>>>>Hi Ping,WarperType::Pointer warper =
>>>
>>>WarperType::New();
>>>  InterpolatorType::Pointer interpolator =
>>>InterpolatorType::New();
>>>  warper->SetInterpolator( interpolator );
>>>  warper->SetOutputSpacing(
>>>towarpreader->GetOutput()->GetSpacing() );
>>>  warper->SetOutputOrigin(
>>>towarpreader->GetOutput()->GetOrigin() );
>>> 
>>>
>>
> warper->SetDeformationField(fieldreader1->GetOutput());
> 
>>>
>>>
>>>>>The error is that you are passing the output of
>>>>
>>>>the
>>>>
>>>>
>>>>>FEMRegistrationFilter as deformation field to the
>>>>>WarpImageFilter:
>>>>>
>>>>>
>>>>>
>>>>>>  warper->SetDeformationField( X->GetOutput()
>>>>
>>>>);
>>>>
>>>>
>>>>>However, GetOutput() in the FEMREgistrationFilter
>>>>>returns
>>
> === message truncated ===
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.
> http://promo.yahoo.com/sbc/
> 






More information about the Insight-users mailing list