<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-BOTTOM: 2px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: Arial Narrow; FONT-SIZE: 12px; PADDING-TOP: 2px">------------------ 原始邮件 ------------------</DIV>
<DIV style="PADDING-BOTTOM: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px; BACKGROUND: #efefef; FONT-SIZE: 12px; PADDING-TOP: 8px">
<DIV><B>发件人:</B> "Jon Haitz Legarreta";<jhlegarreta@vicomtech.org>;</DIV>
<DIV><B>发送时间:</B> 2015年3月20日(星期五) 凌晨0:11</DIV>
<DIV><B>收件人:</B> "转身转瞬"<1549917255@qq.com>; <WBR></DIV>
<DIV><B>抄送:</B> "community"<community@itk.org>; <WBR></DIV>
<DIV><B>主题:</B> Re: [ITK] when using itkImageFileReader to read dicom image , itoccurs assertion failure:pixeltype_debug==pixeltype.</DIV></DIV>
<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 class=gmail_signature>
<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: #ccc 1px solid; 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> <STRONG>connector->Update();//This is the place where error occurs!</STRONG><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">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>