[Insight-users] itkWarpImageFilter

Markus Losacker markus.losacker at gmx.de
Mon May 8 08:26:25 EDT 2006


Hi Luis,

thanks for your help! I tried to scale the deformation field by a 
weighting factor, but all my warped images are the same.
Here is my code:

					ConstDeformationIteratorType inputIt( replacementField, deformationRegion );
					*for*(step = 1; step <= warpSteps; step++)
					{
						*if* (step == 1 || step == warpSteps)
						{
						}
						*else* 
						{
							warpWeight = *static_cast*<double>(step) / warpSteps;
							cerr << "weight = " << warpWeight << endl;
							dest = sliceSize * (begin + (step-1));
							cerr << "step" << step << endl;
							DeformationIteratorType outputIt( intermediateField, deformationRegion);
							*for*(inputIt.GoToBegin(), outputIt.GoToBegin(); !inputIt.IsAtEnd(); ++inputIt, ++outputIt)
							{
								outputIt.Set( inputIt.Get() * warpWeight );
							}
							warpFilter->SetDeformationField( intermediateField );
							warpFilter->Update();
							warpedImage = warpFilter->GetOutput();
							warpedImage->Update();
							cerr << "warp updated" << endl;
							demonImage = mitk::Image::New(); ///conatains the warpedImage/
							demonImage->InitializeByItk(&(*warpedImage), 1, -1, -1);
							cerr << "initialized" << end;
							demonImage->SetVolume(warpedImage->GetBufferPointer());
							cerr << "volume set" << endl;
							warpedVtkData = vtkImageData :: New();
							warpedVtkData = demonImage->GetVtkImageData(0,0);
							warpedData = warpedVtkData->GetScalarPointer();
							shortWarpedData = *static_cast*<short *>(demonImage->GetData());
							cerr << "warpeddatawritten" << endl;

							*for* (sliceCopy_y = 0; sliceCopy_y < y_max; sliceCopy_y++)
							{
								*for* (sliceCopy_x = 0; sliceCopy_x < x_max; sliceCopy_x++)
								{
						
									doubleContourData[sliceCopy_x + (x_max*sliceCopy_y) + ( (begin +( step-1 ) ) * sliceSize ) ] = shortWarpedData[sliceCopy_x + (x_max*sliceCopy_y)];
								}
							}
							
///							/
							cerr << "deleted " << endl;
							cerr << " " << endl;
						}
					}

Best Regards

Markus





Luis Ibanez wrote:
> Hi Markus,
>
> If you already solved the deformable registration problem between your
> fixed and moving images, and have at hand the resulting deformation
> field, you can generate the intermediate version of the deformed moving
> image by taking the deformation field and multiplying it with a number
> between 0.0 and 1.0, then using the resulting vector field in the Warp
> ImageFilter.
>
>
> In pseudocode it will look like
>
>      for i = 1 to 10
>        {
>          intermediateField = deformationField * i / 10.0
>          intermediateImage = Warp( movingimage, intermediateFiedl )
>        }
>
> Please let us know if you need more details on how to implement this
> code.
>
>
>    Regards,
>
>
>       Luis
>
>
>
> -----------------------
> Markus Losacker wrote:
>> Hi all,
>>
>> I´m new to ITK. I have 3D MRI Data, wich is segmented in some 
>> parallel slices. Each segemted slice is a 2D binary image. I´d like 
>> to Iterpolize these slices to a 3D binary image.
>> I tried it with the demonsRegistration and the warpImageFilter and I 
>> got it running. My problem is that I can only Interpolize one slice 
>> between some slices.  Is there the possibility to interpolize several 
>> images between a moving and a fixed image with the same deformation 
>> field?
>> The output should be something like a sequence from the fixed to the 
>> moving image.
>>
>> Best Regards
>>
>> Markus
>>
>>
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>




More information about the Insight-users mailing list