<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Matias,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">center of rotation should use physical units (millimeters).</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default"><font face="verdana, sans-serif">Dženan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)</font></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 15, 2017 at 10:27 AM, Matias Montroull <span dir="ltr"><<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Dzenan,<div dir="auto">The center of rotation is set to use milimeters or image coordinates?</div><div dir="auto">Thanks<span class="HOEnZb"><font color="#888888"><br><br><div data-smartmail="gmail_signature" dir="auto">Matias</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Apr 14, 2017 2:17 PM, "Dženan Zukić" <<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Here is the code I used:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">#include <itkImageFileReader.h></font></div><div class="gmail_default"><font face="monospace, monospace">#include <itkImageFileWriter.h></font></div><div class="gmail_default"><font face="monospace, monospace">#include <itkResampleImageFilter.h></font></div><div class="gmail_default"><font face="monospace, monospace">#include <itkEuler3DTransform.h></font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">template< typename TImage ></font></div><div class="gmail_default"><font face="monospace, monospace">itk::SmartPointer<TImage> ReadImage(const char *filename)</font></div><div class="gmail_default"><font face="monospace, monospace">{</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::ImageFileReader<TImage> ReaderType;</font></div><div class="gmail_default"><font face="monospace, monospace"> typename ReaderType::Pointer r = ReaderType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> r->SetFileName(filename);</font></div><div class="gmail_default"><font face="monospace, monospace"> r->Update();</font></div><div class="gmail_default"><font face="monospace, monospace"> return r->GetOutput();</font></div><div class="gmail_default"><font face="monospace, monospace">}</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">template< typename TImage ></font></div><div class="gmail_default"><font face="monospace, monospace">void WriteImage(itk::SmartPointer<T<wbr>Image> out, const char *filename)</font></div><div class="gmail_default"><font face="monospace, monospace">{</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::ImageFileWriter<TImage> WriterType;</font></div><div class="gmail_default"><font face="monospace, monospace"> typename WriterType::Pointer w = WriterType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> w->SetInput(out);</font></div><div class="gmail_default"><font face="monospace, monospace"> w->SetFileName(filename);</font></div><div class="gmail_default"><font face="monospace, monospace"> //w->SetUseCompression(true);</font></div><div class="gmail_default"><font face="monospace, monospace"> w->Update();</font></div><div class="gmail_default"><font face="monospace, monospace">}</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">int main(int argc, char *argv[])</font></div><div class="gmail_default"><font face="monospace, monospace">{</font></div><div class="gmail_default"><font face="monospace, monospace"> const unsigned int dimension = 3;</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::Image<short, dimension> ImageType;</font></div><div class="gmail_default"><font face="monospace, monospace"> ImageType::Pointer inputImage = ReadImage<ImageType>("C:/CBCT.<wbr>nrrd");</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::ResampleImageFilter<Image<wbr>Type, ImageType> FilterType;</font></div><div class="gmail_default"><font face="monospace, monospace"> FilterType::Pointer FiltroResample = FilterType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetInput(input<wbr>Image);</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::LinearInterpolateImageFun<wbr>ction<ImageType, double> InterpolatorType;</font></div><div class="gmail_default"><font face="monospace, monospace"> InterpolatorType::Pointer interpolator = InterpolatorType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetInterpolato<wbr>r(interpolator);</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetOutputDirec<wbr>tion(inputImage->GetDirection(<wbr>));</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetOutputOrigi<wbr>n(inputImage->GetOrigin());</font></div><div class="gmail_default"><font face="monospace, monospace"> ImageType::SizeType inputSize = inputImage->GetLargestPossible<wbr>Region().GetSize();</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetSize(inputS<wbr>ize);</font></div><div class="gmail_default"><font face="monospace, monospace"> const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing();</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetOutputSpaci<wbr>ng(inputSpacing);</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetDefaultPixe<wbr>lValue(-1000);</font></div><div class="gmail_default"><font face="monospace, monospace"> typedef itk::Euler3DTransform<double> TransformType;</font></div><div class="gmail_default"><font face="monospace, monospace"> TransformType::Pointer transform = TransformType::New();</font></div><div class="gmail_default"><font face="monospace, monospace"> transform->SetRotation(0.2, 0.3, 0.5);</font></div><div class="gmail_default"><font face="monospace, monospace"> double centro[3] = { 10,20,30 };</font></div><div class="gmail_default"><font face="monospace, monospace"> transform->SetCenter(centro);</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->SetTransform(t<wbr>ransform);</font></div><div class="gmail_default"><font face="monospace, monospace"> FiltroResample->Update();</font></div><div class="gmail_default"><font face="monospace, monospace"> WriteImage<ImageType>(FiltroRe<wbr>sample->GetOutput(), "C:/cbctResampled.nrrd");</font></div><div class="gmail_default"><font face="monospace, monospace">}</font></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 14, 2017 at 1:15 PM, Dženan Zukić <span dir="ltr"><<a href="mailto:dzenanz@gmail.com" target="_blank">dzenanz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Matias,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I didn't compile to use with Slicer. I only open the input and output image in Slicer to visualize them.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">But making a Slicer CLI module is fairly easy. You can take a look at <a href="https://github.com/Slicer/Slicer/tree/master/Modules/CLI/AddScalarVolumes/" target="_blank">one</a> of the existing modules, <a href="https://www.slicer.org/wiki/Documentation/Nightly/Developers/Modules" target="_blank">docs</a> including <a href="https://www.slicer.org/wiki/Documentation/Nightly/Developers/ExtensionWizard" target="_blank">extension wizard</a>.</div><span><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default"><font face="verdana, sans-serif">Dženan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)</font></div></div></div></span></div><div class="m_1668592979011136862m_-8175401678043046662HOEnZb"><div class="m_1668592979011136862m_-8175401678043046662h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 14, 2017 at 12:26 PM, Matias <span dir="ltr"><<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Dzenan. I actually use OrigenX and OrigenY to assign it to the DCM tags. Just curious, how did you compile to use with Slicer?</div><br><div class="gmail_quote"><span><div dir="ltr">El jue., 13 de abr. de 2017 a la(s) 12:14, Dženan Zukić [via ITK - Users] <<a href="http:///user/SendEmail.jtp?type=node&node=38121&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> escribió:<br></div></span><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><span>
<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Matias,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">you are not using origenX or origenY after they are defined. But your program (with modifications to make it compile) works for me:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><img src="http://itk-users.7.n7.nabble.com/attachment/38116/0/Screenshot%202017-04-13%2011.09.11.jpg" alt="Inline image 1" width="528" height="562"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,</div><div class="gmail_default"><font face="verdana, sans-serif">Dženan Zukić, PhD, Senior R&D Engineer, Kitware (Carrboro, N.C.)</font></div></div></div></div></span><div><div class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 8, 2017 at 6:08 PM, Matias <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=38116&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span> wrote:<br>Hi,
I'm rotating a volume (Using the Euler3DTransform) and the final set of slices are half black or empty.
here's an example when rotating a volume of 10 slices:
Am I missing something such as changing the origin or maybe computing the center incorrectly? (The center is passed as parameter from another program)
<img src="http://itk-users.7.n7.nabble.com/file/n38081/capture.jpg" border="0">
And here's the code I'm using:
typedef itk::ResampleImageFilter<Image<wbr>Type, ImageType> FilterType;
FilterType::Pointer FiltroResample = FilterType::New();
FiltroResample->SetInput(reade<wbr>r->GetOutput());
typedef itk::LinearInterpolateImageFun<wbr>ction<ImageType, double > InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
FiltroResample->SetInterpolato<wbr>r(interpolator);
FiltroResample->SetOutputDirec<wbr>tion(inputImage->GetDirection(<wbr>));
FiltroResample->SetOutputOrigi<wbr>n(inputImage->GetOrigin());
ImageType::SizeType inputSize = inputImage->GetLargestPossible<wbr>Region().GetSize();
FiltroResample->SetSize(inputS<wbr>ize);
const ImageType::SpacingType& inputSpacing = inputImage->GetSpacing();
FiltroResample->SetOutputSpaci<wbr>ng(inputSpacing);
FiltroResample->SetDefaultPixe<wbr>lValue(-1000);
typedef itk::Euler3DTransform< double > TransformType; //Transform
TransformType::Pointer transform = TransformType::New();
double alfa, beta, gamma, centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z, origenX,origenY;
gamma = atof(argv[2]);
beta = atof(argv[3]);
alfa = atof(argv[4]);
centro_rotacion_X = atof(argv[5]);
centro_rotacion_Y = atof(argv[6]);
centro_rotacion_Z = atof(argv[7]);
origenX = atof(argv[8]);
origenY = atof(argv[9]);
transform->SetRotation(gamma, beta, alfa);
double centro[3] = { centro_rotacion_X, centro_rotacion_Y, centro_rotacion_Z };
transform->SetCenter(centro);
FiltroResample->SetTransform(t<wbr>ransform);
FiltroResample->Update();
<br><hr align="left" width="300">
View this message in context: <a href="http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081.html" rel="nofollow" link="external" target="_blank">Rotating image results in last slices being half empty</a><br>
Sent from the <a href="http://itk-users.7.n7.nabble.com/" rel="nofollow" link="external" target="_blank">ITK - Users mailing list archive</a> at Nabble.com.<br><br>______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="nofollow" link="external" 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" rel="nofollow" link="external" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="nofollow" link="external" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="nofollow" link="external" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="nofollow" link="external" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
<br></div></div></div></div></blockquote></div><div><div class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457h5"><br>
<br>______________________________<wbr>_______
<br>Powered by <a href="http://www.kitware.com" rel="nofollow" link="external" 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" rel="nofollow" link="external" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:
<br><a href="http://www.kitware.com/products/protraining.php" rel="nofollow" link="external" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:
<br><a href="http://www.itk.org/Wiki/ITK_FAQ" rel="nofollow" link="external" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br><br>Follow this link to subscribe/unsubscribe:
<br><a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="nofollow" link="external" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
<br>
<br>
</div></div><hr noshade size="1" color="#cccccc">
<div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081p38116.html" rel="nofollow" link="external" target="_blank">http://itk-users.7.n7.nabble.c<wbr>om/Rotating-image-results-in-l<wbr>ast-slices-being-half-empty-tp<wbr>38081p38116.html</a>
</div>
<div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
To unsubscribe from Rotating image results in last slices being half empty, <a rel="nofollow" link="external">click here</a>.<br>
<a href="http://itk-users.7.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" link="external" target="_blank">NAML</a><span class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457HOEnZb"><font color="#888888">
</font></span></div><span class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457HOEnZb"><font color="#888888"><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Matias</div></div>
<br><hr align="left" width="300">
View this message in context: <a href="http://itk-users.7.n7.nabble.com/Rotating-image-results-in-last-slices-being-half-empty-tp38081p38121.html" target="_blank">Re: [ITK-users] Rotating image results in last slices being half empty</a></font></span><div class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457HOEnZb"><div class="m_1668592979011136862m_-8175401678043046662m_2762722809962524457h5"><br>
Sent from the <a href="http://itk-users.7.n7.nabble.com/" target="_blank">ITK - Users mailing list archive</a> at Nabble.com.<br></div></div><br>______________________________<wbr>_______<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/product<wbr>s/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FA<wbr>Q</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div>
</div></div></blockquote></div><br></div>