[vtkusers] Testing DICOM reading success in C++

Chris Want cwant at ualberta.ca
Thu Nov 9 13:38:45 EST 2006


Hi all,

I am writing a program that reads DICOM data, and
I have a vtkDICOMImageReader called 'reader' and some
very standard code like this:

reader->SetDirectoryName(dirname);
reader->Update();

Now, if I put something bogus into the variable dirname,
VTK prints some error message like:

ERROR: In /usr/local/src/vtk/VTK/IO/vtkDICOMImageReader.cxx, line 158
vtkDICOMImageReader (0x1a549c0): Couldn't open blahblahblah

ERROR: In /usr/local/src/vtk/VTK/IO/vtkDICOMImageReader.cxx, line 256
vtkDICOMImageReader (0x1a549c0): Either a filename was not specified or 
the specified directory does not contain any DICOM images.

... but the code happily chugs along as if the DICOM data read
had been successful, and ends up processing empty data.

Neither reader->SetDirectoryName() nor reader->Update() have
a return code that I can test ... does anybody know the
correct way to test that the reader was successful using C++?

Regards,
Chris

-- 
  ____________________________________________________________________
( Chris Want                                                         )
( Research Computing Support                                         )
( Academic Information and Communication Technologies (AICT)         )
( University of Alberta                                              )
( Tel: 1-780-492-9418                                                )
  --------------------------------------------------------------------



More information about the vtkusers mailing list