[Insight-users] Apply Transform

Luis Ibanez luis.ibanez at kitware.com
Tue Jun 30 11:22:50 EDT 2009


Hi Steban,

You seem to be calling the filters correctly.

It is always possible that a bug may be lingering
in the code. However, these particular filters are
heavily used, and we have high confidence in them
at this point.


Several questions:


 A) What file format are you using for the input image

 B) What file format are you using for the output image

 C) What visualization software are you using for looking
      at the images.


It is a common problem to use inadequate visualization
software, and derive incorrect conclusions from such
the improper resulting visualizations.


Please give us more details,

and... again...
one or several screen shots will be really useful here....


       Thanks


            Luis


---------------------------------------------------------------
On Mon, Jun 29, 2009 at 2:31 PM, Oscar Esteban Sanz-Dranguet <
oesteban at die.upm.es> wrote:

> Hi again,
>
> I have to add some information. All transforms seem to be working as
> spected. When I compute the transformation for the center point, it returns
> the same point (no matter the rotation axis, so OK).
>
> Could it be a bug on itk::ResampleImageFilter< ImageType, ImageType > or
> itk::ImageFileWriter< ImageType > ?
> Am I calling the filters correctly?
>
> Thanks,
> Oscar Esteban
>
> Oscar Esteban Sanz-Dranguet escribió:
>
>  Hi,
>>
>> I try to apply a rigid transform to some mri images. After SetCenter, only
>> rotation about Y axis seems to use this center. Why I don't get the correct
>> center of rotation about X and Z axis? (code at the end)
>>
>> Best Regards,
>> Oscar Esteban
>>
>>
>> <<<<<<<<<<<<<<<<< CODE >>>>>>>>>>>>>>>>>>>>>>
>> int main( int argc, char *argv[] )
>>  {
>>  if ( argc < 8 )
>>   {
>>   std::cerr << "Missing Parameters " << std::endl;
>>   std::cerr << "Usage: " << argv[0];
>>   std::cerr << " inputImageFile outputImageFile";
>>   std::cerr << " traslationX traslationY traslationZ";
>>   std::cerr << " rotationX rotationY rotationZ";
>>   std::cerr << std::endl;
>>   return 1;
>>   }
>>
>>  typedef itk::ImageFileReader< ImageType > ImageReaderType;
>>
>>  typedef itk::Euler3DTransform< double > TransformType;
>>
>>  // Read images
>>  ImageReaderType::Pointer  imageReader  = ImageReaderType::New();
>>  imageReader->SetFileName( argv[1] );
>>  imageReader->Update();
>>  ImageType::Pointer  image =  imageReader->GetOutput();
>>  ImageType::SpacingType spacing = image->GetSpacing();
>>  ImageType::IndexType pixelCenter = { 128, 128, 58 };
>>
>>  image->SetPixel( pixelCenter, 255);
>>
>>  TransformType::Pointer      transform     = TransformType::New();
>>
>>  TransformType::InputPointType center;
>>  center[0] = 128.5 * spacing[0];
>>  center[1] = 128.5 * spacing[1];
>>  center[2] = 58.5 *  spacing[2];
>>  transform->SetCenter( center );
>>
>>  TransformType::OutputVectorType translation;
>>  translation[0] = atof( argv[3] ) * spacing[0];
>>  translation[1] = atof( argv[4] ) * spacing[1];
>>  translation[2] = atof( argv[5] ) * spacing[2];
>>
>>  transform->SetRotation( deg2rad( atof( argv[6] ) ), deg2rad( atof(
>> argv[7] ) ), deg2rad( atof( argv[8] ) ) );
>>  transform->SetTranslation( translation );
>>
>>  transform->Print(std::cout, 3);
>>
>>  typedef itk::ResampleImageFilter< ImageType, ImageType >
>>  ResampleFilterType;
>>  ResampleFilterType::Pointer resampler = ResampleFilterType::New();
>>
>>  resampler->SetTransform( transform );
>>  resampler->SetInput( image );
>>  resampler->SetReferenceImage( image );
>>  resampler->UseReferenceImageOn( );
>>  resampler->Update();
>>
>>  typedef itk::ImageFileWriter< ImageType >  WriterType;
>>  WriterType::Pointer writer =  WriterType::New();
>>  writer->SetFileName( argv[2] );
>>  writer->SetInput( resampler->GetOutput() );
>>  writer->Update();
>>
>>  return EXIT_SUCCESS;
>>  }
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> 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
>>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090630/5bd37399/attachment.htm>


More information about the Insight-users mailing list