<br>Hi Steban,<br><br>You seem to be calling the filters correctly.<br><br>It is always possible that a bug may be lingering<br>in the code. However, these particular filters are<br>heavily used, and we have high confidence in them<br>
at this point.<br><br><br>Several questions:<br><br><br> A) What file format are you using for the input image<br><br> B) What file format are you using for the output image<br><br> C) What visualization software are you using for looking<br>
at the images.<br><br><br>It is a common problem to use inadequate visualization<br>software, and derive incorrect conclusions from such<br>the improper resulting visualizations.<br><br><br>Please give us more details,<br>
<br>and... again... <br>one or several screen shots will be really useful here....<br><br><br> Thanks<br><br><br> Luis<br><br> <br>---------------------------------------------------------------<br><div class="gmail_quote">
On Mon, Jun 29, 2009 at 2:31 PM, Oscar Esteban Sanz-Dranguet <span dir="ltr"><<a href="mailto:oesteban@die.upm.es">oesteban@die.upm.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi again,<br>
<br>
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).<br>
<br>
Could it be a bug on itk::ResampleImageFilter< ImageType, ImageType > or itk::ImageFileWriter< ImageType > ?<br>
Am I calling the filters correctly?<br>
<br>
Thanks,<br>
Oscar Esteban<br><font color="#888888">
<br>
Oscar Esteban Sanz-Dranguet escribió:</font><div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
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)<br>
<br>
Best Regards,<br>
Oscar Esteban<br>
<br>
<br>
<<<<<<<<<<<<<<<<< CODE >>>>>>>>>>>>>>>>>>>>>><br>
int main( int argc, char *argv[] )<br>
{<br>
if ( argc < 8 )<br>
{<br>
std::cerr << "Missing Parameters " << std::endl;<br>
std::cerr << "Usage: " << argv[0];<br>
std::cerr << " inputImageFile outputImageFile";<br>
std::cerr << " traslationX traslationY traslationZ";<br>
std::cerr << " rotationX rotationY rotationZ";<br>
std::cerr << std::endl;<br>
return 1;<br>
}<br>
<br>
typedef itk::ImageFileReader< ImageType > ImageReaderType;<br>
<br>
typedef itk::Euler3DTransform< double > TransformType;<br>
<br>
// Read images<br>
ImageReaderType::Pointer imageReader = ImageReaderType::New();<br>
imageReader->SetFileName( argv[1] );<br>
imageReader->Update();<br>
ImageType::Pointer image = imageReader->GetOutput();<br>
ImageType::SpacingType spacing = image->GetSpacing();<br>
ImageType::IndexType pixelCenter = { 128, 128, 58 };<br>
<br>
image->SetPixel( pixelCenter, 255);<br>
<br>
TransformType::Pointer transform = TransformType::New();<br>
<br>
TransformType::InputPointType center;<br>
center[0] = 128.5 * spacing[0];<br>
center[1] = 128.5 * spacing[1];<br>
center[2] = 58.5 * spacing[2];<br>
transform->SetCenter( center );<br>
<br>
TransformType::OutputVectorType translation;<br>
translation[0] = atof( argv[3] ) * spacing[0];<br>
translation[1] = atof( argv[4] ) * spacing[1];<br>
translation[2] = atof( argv[5] ) * spacing[2];<br>
<br>
transform->SetRotation( deg2rad( atof( argv[6] ) ), deg2rad( atof( argv[7] ) ), deg2rad( atof( argv[8] ) ) );<br>
transform->SetTranslation( translation );<br>
<br>
transform->Print(std::cout, 3);<br>
<br>
typedef itk::ResampleImageFilter< ImageType, ImageType > ResampleFilterType;<br>
ResampleFilterType::Pointer resampler = ResampleFilterType::New();<br>
<br>
resampler->SetTransform( transform );<br>
resampler->SetInput( image );<br>
resampler->SetReferenceImage( image );<br>
resampler->UseReferenceImageOn( );<br>
resampler->Update();<br>
<br>
typedef itk::ImageFileWriter< ImageType > WriterType;<br>
WriterType::Pointer writer = WriterType::New();<br>
writer->SetFileName( argv[2] );<br>
writer->SetInput( resampler->GetOutput() );<br>
writer->Update();<br>
<br>
return EXIT_SUCCESS;<br>
}<br>
<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br>