<div dir="ltr"><div><div><div><div>Hi Guirong,<br>I'd try updating the reader before getting its output and surrounding it with a try/catch [1], so that you can be sure that it's (not) the reader which is producing the error.<br></div>I'd then do the same with the next filter.<br><br></div>In addition, that will give you a better description of the error.<br><br></div>HTH,<br></div>JON HAITZ<br><br><div><div><div>[1] <a href="http://itk.org/Wiki/ITK/Examples/SimpleOperations/TryCatch">http://itk.org/Wiki/ITK/Examples/SimpleOperations/TryCatch</a><br><br><br><div><br><div class="gmail_extra"><div class="gmail_quote">On 21 March 2015 at 09:22, 转身转瞬 <span dir="ltr"><<a href="mailto:1549917255@qq.com" target="_blank">1549917255@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Dear Jon,</div>
<div>    Thanks for your reply.</div>
<div>    I only specified pixel type in the this line(typedef itk::Image<unsigned char,2> ImageType;),and after receiving your reply, I changed it to unsigned short, short, and signed short which was not working unfortunately.</div>
<div>    Have any other thoughts about it?</div>
<div>                                                                                                                                   Guirong Liu<br></div>
<div>
<div><br></div>
<div style="padding:2px 0px;font-family:Arial Narrow;font-size:12px">------------------ 原始邮件 ------------------</div>
<div style="padding:8px;background:none repeat scroll 0% 0% rgb(239,239,239);font-size:12px">
<div><b>发件人:</b> "Jon Haitz Legarreta";<<a href="mailto:jhlegarreta@vicomtech.org" target="_blank">jhlegarreta@vicomtech.org</a>>;</div>
<div><b>发送时间:</b> 2015年3月20日(星期五) 凌晨0:11</div>
<div><b>收件人:</b> "转身转瞬"<<a href="mailto:1549917255@qq.com" target="_blank">1549917255@qq.com</a>>; <u></u></div>
<div><b>抄送:</b> "community"<<a href="mailto:community@itk.org" target="_blank">community@itk.org</a>>; <u></u></div>
<div><b>主题:</b> Re: [ITK] when using itkImageFileReader to read dicom image , itoccurs assertion failure:pixeltype_debug==pixeltype.</div></div><div><div class="h5">
<div><br></div>
<div dir="ltr">Dear Guirong,
<div>
<div>
<div>DICOM images most commonly use short pixel types.</div></div>
<div><br></div>
<div>The error says that there is some problem with the pixel type you specified.</div></div>
<div><br></div>
<div>HTH,</div>
<div>JON HAITZ</div>
<div><br></div>
<div class="gmail_extra">
<div>
<div>
<div dir="ltr"><br></div>
<div dir="ltr"><br></div></div></div>
<div class="gmail_quote">On 19 March 2015 at 16:44, 转身转瞬 <span dir="ltr"><<a href="mailto:1549917255@qq.com" target="_blank">1549917255@qq.com</a>></span> wrote:<br>
<blockquote style="border-left:1px solid rgb(204,204,204);margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote">
<div>Hi,everyone,</div>
<div>     I'm using ITK to read CTA image(it's a kind of dicom image),and when it runs to the update ,the following error happens:</div>
<div>
<div>
<div> in command line:Assertion failed:pixeltype_debug==pixeltype.  file..\..\..\..\..\InsightToolkit-4.4.0\Modules\IO\GDCM\src\itkGDCMImageIO.cxx,line 287</div>
<div> </div>
<div>in a window:</div>
<div>Debug Error!</div>
<div>Program:F:\..\..\..\helloworld7.exe</div>
<div>R6010</div>
<div>-abort() has been called</div>
<div>(Press Retry to debug the application)</div>
<div> </div>
<div> </div>
<div>My code is as follows:</div>
<div>#include"itkImage.h"<br>#include"itkImageFileReader.h"<br>#include"itkImageToVTKImageFilter.h"<br>#include<itkGDCMImageIO.h><br>#include"vtkImageViewer.h"<br>#include"vtkRenderWindowInteractor.h"<br>#include"vtkSmartPointer.h"<br>#include"vtkImageFlip.h"<br>#include"vtkRenderer.h"<br>#include"vtkImageActor.h"<br>#include"vtkCamera.h"<br>#include"vtkImageMapper.h"</div>
<div>using namespace std;</div>
<div>int main()<br>{</div>
<div> typedef itk::Image<unsigned char,2> ImageType;<br> typedef itk::ImageFileReader<ImageType> ReaderType;  <br> ReaderType::Pointer reader=ReaderType::New();</div>
<div> //获得DICOM文件读取对象<br> typedef itk::GDCMImageIO ImageIOType;<br> ImageIOType::Pointer gdcmImageIO=ImageIOType::New();</div>
<div> //Filter of itk image data to vtk image data;<br> typedef itk::ImageToVTKImageFilter<ImageType> FilterType;<br> FilterType::Pointer connector=FilterType::New();</div>
<div> //获得DICOM文件名并读取DICOM文件;<br> char*DICOMName="F://c++projects//helloworld6//1.3.12.2.1107.5.1.4.60540.30000013102023122056200010862";<br> reader->SetFileName(DICOMName);<br> reader->SetImageIO(gdcmImageIO);</div>
<div> cout<<"done0"<<endl;<br> //ITK到VTK转化      <br> connector->SetInput(reader->GetOutput());<br> cout<<"done1"<<endl;<br> <b>connector->Update();//This is the place where error occurs!</b><br> cout<<"done2"<<endl;</div>
<div> vtkSmartPointer<vtkImageFlip>flip=vtkSmartPointer<vtkImageFlip>::New();<br> //vtkSmartPointer<vtkImageMapper><br> flip->SetInput(connector->GetOutput());<br> flip->SetFilteredAxis(1);<br> //需要进行上下翻转才能正确显示;<br> flip->Update();</div>
<div><br> vtkSmartPointer<vtkImageActor>actor=vtkSmartPointer<vtkImageActor>::New();<br> actor->SetInput(flip->GetOutput());<br> actor->InterpolateOff();</div>
<div> vtkSmartPointer<vtkRenderer>renderer=vtkSmartPointer<vtkRenderer>::New();<br> renderer->AddActor(actor);</div>
<div><br> vtkSmartPointer<vtkRenderWindow>renderWindow=vtkSmartPointer<vtkRenderWindow>::New();<br> renderWindow->AddRenderer(renderer);</div>
<div> vtkRenderWindowInteractor*iren=vtkRenderWindowInteractor::New();</div>
<div> iren->SetRenderWindow(renderWindow);<br> iren->Initialize();<br> iren->Start();</div>
<div> return 0;<br>}</div>
<div>If anyone know how to fix this, could you please just help me?</div>
<div>Thanks a lot.</div>
<div>                                                                                                                                        Guirong Liu</div>
<div> </div></div></div><br>_______________________________________________<br>Community mailing list<br><a href="mailto:Community@itk.org" target="_blank">Community@itk.org</a><br><a href="http://public.kitware.com/mailman/listinfo/community" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br><br></blockquote></div><br></div></div>
<div></div></div></div></div></blockquote></div><br></div></div></div></div></div></div>