[vtkusers] gdcm reader setfilenames

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Jul 9 03:29:06 EDT 2009


Hi,

On Wed, Jul 8, 2009 at 4:29 PM, puneet agrawal<puneet0288 at gmail.com> wrote:
> hi,
>  I try to use this gdcm vtkGDCMImageReader.here is my code

You should really direct your GDCM question to the GDCM ML, see FAQ:

http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=General_questions#Where_are_the_GDCM_mailing_lists_.3F

> 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);

Did you check dirname ends with a trailing '/' character ?


> vtkGDCMImageReader *dicomReader=vtkGDCMImageReader::New();
> //dicomReader->SetDirectoryName(dirname);// this is wokring with //
> vtkdicomimagereader

SetDirectoryName is a specific API only found in vtkDICOMImageReader.
It did not make any sense when implementing vtkGDCMImageReader, thus
only vtkGDCMImageReader::SetFileNames is implemented.

> dicomReader->SetFileNames( ff );
>    dicomReader->Update();
>
> When i run this code.I got this error and i checked that my image path

No you don't. At least this is impossible from the code you sent.

> 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

You are not sending the actual piece of code that is generating this error.

-- 
Mathieu



More information about the vtkusers mailing list