<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Hi Majid,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-family:verdana,sans-serif">maybe you need to invoke </span><font face="monospace, monospace">reslice->Update();</font><font face="verdana, sans-serif"> before importing its output into ITK?</font></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">Regards,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 13, 2018 at 11:31 AM, Majid M. Sadeghi via vtkusers <span dir="ltr"><<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><div id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66356"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66427">Dear All,<br></span></div><div id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66425"><span><br></span></div><div id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66437" dir="ltr"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66493">I read some DICOM data using vtkGDCMImageReader, then I change the sapacing and reslice them. Next I want to change that vtk image to itk image to be able to apply noise removal. But as soon as the code reaches the "filter_toitkimage->Update();" line the program just exits without saying anything (actually it says:The program '[14040] QtGuiApplication2.exe' has exited with code 3 (0x3).).</span></div><div dir="ltr" id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_68538"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66493"><br></span></div><div dir="ltr" id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_68537"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66493">Here is the code:</span></div><div dir="ltr" id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66607"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66493"><br></span></div><div dir="ltr" id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66585"><span id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66493">vtkSmartPointer<<wbr>vtkGDCMImageReader> reader = vtkSmartPointer<<wbr>vtkGDCMImageReader>::New();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66667"> reader->SetFileNames(vtkfiles)<wbr>;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66668"> reader->Update();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66669"> <br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66670"> vtkSmartPointer<<wbr>vtkImageChangeInformation> changer = vtkSmartPointer<<wbr>vtkImageChangeInformation>::<wbr>New();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66671"> changer->SetOutputSpacing(<wbr>pixlespacing, pixlespacing, ippzspacing);//@majidnow<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66672"> changer->SetInputConnection(<wbr>reader->GetOutputPort());<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66673"><br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66674"> vtkSmartPointer<<wbr>vtkImageReslice> reslice = vtkSmartPointer<<wbr>vtkImageReslice>::New();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66675"> reslice->SetInputConnection(<wbr>changer->GetOutputPort());<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66676"> <br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66677"> //to change VTK image to ITK image<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66678"> const unsigned int Dimension = 3;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66679"><br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66680"> using PixelType = double;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66681"> using ImageType = itk::Image< PixelType, Dimension >;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66682"><br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66683"> using FilterType = itk::VTKImageToImageFilter< ImageType >;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66684"> FilterType::Pointer filter_toitkimage = FilterType::New();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66685"> filter_toitkimage->SetInput(<wbr>reslice->GetOutput());<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66686"><br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66687"> try<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66688"> {<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66689"> filter_toitkimage->Update();<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66690"> }<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66691"> catch (itk::ExceptionObject & error)<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66692"> {<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66693"> std::cerr << "Error: " << error << std::endl;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66694"> //return EXIT_FAILURE;<br id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66695"> }</span></div><div id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66355"><div> </div><div><br></div><div>Any idea why this happens?<br></div></div><div class="m_6380917476409518527signature" id="m_6380917476409518527yui_3_16_0_ym19_1_1518530601371_66350"><br></div></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 <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>