[vtk-developers] gdcm reader setfilenames

puneet agrawal puneet0288 at gmail.com
Wed Jul 8 07:26:33 EDT 2009


hi,
  I try to use this gdcm vtkGDCMImageReader.here is my code
vtkDirectory* dir = vtkDirectory::New();
	 dir->Open( dirname );
	  vtkStringArray *files = dir->GetFiles();		
		vtkStdString filename;
   		const char * modfilename;
   //vtkDICOMImageReader *dicomReader = vtkDICOMImageReader::New();
vtkStringArray *ff=vtkStringArray::New();
for(int co=0;co<files->GetNumberOfValues();co++)
{
vtkStdString value = files->GetValue(co);
std::cout << value<<endl;
filename=dirname+files->GetValue(co);
modfilename=filename.c_str();
ff->InsertNextValue(modfilename);
std::cout<< modfilename << endl;
}
	
vtkGDCMImageReader *dicomReader=vtkGDCMImageReader::New();
//dicomReader->SetDirectoryName(dirname);// this is wokring with //
vtkdicomimagereader

dicomReader->SetFileNames( ff );
    dicomReader->Update();

When i run this code.I got this error and i checked that my image path
is currect:
>>>>
ERROR: In /home/chander/puneet/VTK/Filtering/vtkImageData.cxx, line 1344
vtkImageData (0xc8d360): Bad component index 4692354

ERROR: In /home/chander/puneet/VTK/Filtering/vtkImageData.cxx, line 1344
vtkImageData (0xc99c10): Bad component index 13173552

Segmentation fault
Please help.

Thanks
Puneet



More information about the vtk-developers mailing list