<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 class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>