Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends

creaImageIO::DicomImageReader Class Reference
[Image I/O classes]

Concrete image reader for DICOM images. More...

#include <creaImageIODicomImageReader.h>

Inheritance diagram for creaImageIO::DicomImageReader:
Inheritance graph
[legend]
Collaboration diagram for creaImageIO::DicomImageReader:
Collaboration graph
[legend]

List of all members.

Classes

struct  deleter

Public Member Functions

 DicomImageReader ()
virtual ~DicomImageReader ()
virtual void PushBackExtensions (std::vector< std::string > &)
 Add file extensions read by the reader.
virtual bool CanRead (const std::string &filename)
 Test if file is read by this reader.
virtual vtkImageData * ReadImage (const std::string &filename)
 return for a file a 2D VTkImage
virtual void ReadAttributes (const std::string &filename, tree::AttributeMapType &attr)
 Read the attributes for a file.
void getAttributes (const std::string filename, std::map< std::string, std::string > &infos, std::vector< std::string > i_attr)
 Another function to read attributes for a file.
 DicomImageReader ()
virtual ~DicomImageReader ()
virtual void PushBackExtensions (std::vector< std::string > &)
 Add file extensions read by the reader.
virtual bool CanRead (const std::string &filename)
 Test if file is read by this reader.
virtual vtkImageData * ReadImage (const std::string &filename)
 return for a file a 2D VTkImage
virtual void ReadAttributes (const std::string &filename, tree::AttributeMapType &attr)
 Read the attributes for a file.
void ReadAttributes2 (const std::string &filename, tree::AttributeMapType &attr)
void getAttributes (const std::string filename, std::map< std::string, std::string > &infos, std::vector< std::string > i_attr)
 Another function to read attributes for a file.
const std::string & GetName () const
 Get the reader's name.

Protected Member Functions

void SetName (const std::string &s)
 Set the reader's name.

Private Member Functions

const std::string GetStringValueFromTag (const gdcm::DataElement &ds)

Private Attributes

vtkGdcmReader * mReader
vtkGDCMImageReader * mReader
gdcm::Scanner mscan
bool b_loaded

Friends

struct deleter

Detailed Description

Concrete image reader for DICOM images.

Definition at line 20 of file creaImageIODicomImageReader.h.


Constructor & Destructor Documentation

creaImageIO::DicomImageReader::DicomImageReader (  ) 

Definition at line 20 of file creaImageIODicomImageReader.cpp.

References mReader, and creaImageIO::AbstractImageReader::SetName().

  {
    mReader = vtkGdcmReader::New();
//EED   mReader->SetFlipY(false);
    SetName ( "Dicom" );

  };

Here is the call graph for this function:

creaImageIO::DicomImageReader::~DicomImageReader (  )  [virtual]

Definition at line 30 of file creaImageIODicomImageReader.cpp.

References mReader.

  {
    mReader->Delete();
  }

creaImageIO::DicomImageReader::DicomImageReader (  ) 
virtual creaImageIO::DicomImageReader::~DicomImageReader (  )  [virtual]

Member Function Documentation

bool creaImageIO::DicomImageReader::CanRead ( const std::string &  filename  )  [virtual]

Test if file is read by this reader.

Reimplemented from creaImageIO::AbstractImageReader.

Definition at line 37 of file creaImageIODicomImageReader.cpp.

  { 
    GDCM_NAME_SPACE::Document*doc;
    GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
    file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
    file->SetFileName(filename.c_str());
    file->Load();
    bool ok = file->IsReadable();
        if(!ok)
        {
                doc = (GDCM_NAME_SPACE::Document*)file; 
                ok = doc->IsReadable();
        }
    file->Delete();
    return ok;
  }

virtual bool creaImageIO::DicomImageReader::CanRead ( const std::string &  filename  )  [virtual]

Test if file is read by this reader.

Reimplemented from creaImageIO::AbstractImageReader.

void creaImageIO::DicomImageReader::getAttributes ( const std::string  filename,
std::map< std::string, std::string > &  infos,
std::vector< std::string >  i_attr 
) [virtual]

Another function to read attributes for a file.

Reimplemented from creaImageIO::AbstractImageReader.

Definition at line 104 of file creaImageIODicomImageReader.cpp.

References ReadAttributes().

        {
                std::vector<std::string>::iterator it = i_attr.begin();
                for(; it != i_attr.end(); it++)
                {
                        infos[(*it)] = "";
                }
                ReadAttributes(filename, infos);
        }

Here is the call graph for this function:

void creaImageIO::DicomImageReader::getAttributes ( const std::string  filename,
std::map< std::string, std::string > &  infos,
std::vector< std::string >  i_attr 
) [virtual]

Another function to read attributes for a file.

Reimplemented from creaImageIO::AbstractImageReader.

const std::string& creaImageIO::AbstractImageReader::GetName (  )  const [inline, inherited]

Get the reader's name.

Definition at line 16 of file creaImageIOAbstractImageReader.h.

Referenced by creaImageIO::VtkImageReader::VtkImageReader().

{

Here is the caller graph for this function:

const std::string creaImageIO::DicomImageReader::GetStringValueFromTag ( const gdcm::DataElement &  ds  )  [private]

Definition at line 242 of file creaImageIODicomImageReader2.cpp.

{
  static std::string buffer;
  buffer = "";  // cleanup previous call


    const gdcm::ByteValue *bv = de.GetByteValue();
    if( bv ) // Can be Type 2
      {
      buffer = std::string( bv->GetPointer(), bv->GetLength() );
      // Will be padded with at least one \0
      }

  // Since return is a const char* the very first \0 will be considered
  return buffer.c_str();
}

void creaImageIO::DicomImageReader::PushBackExtensions ( std::vector< std::string > &  v  )  [virtual]

Add file extensions read by the reader.

Reimplemented from creaImageIO::AbstractImageReader.

Definition at line 75 of file creaImageIODicomImageReader.cpp.

  {
    v.push_back("dcm");
    v.push_back("");
  }

virtual void creaImageIO::DicomImageReader::PushBackExtensions ( std::vector< std::string > &   )  [virtual]

Add file extensions read by the reader.

Reimplemented from creaImageIO::AbstractImageReader.

virtual void creaImageIO::DicomImageReader::ReadAttributes ( const std::string &  filename,
tree::AttributeMapType attr 
) [virtual]

Read the attributes for a file.

Reimplemented from creaImageIO::AbstractImageReader.

virtual void creaImageIO::DicomImageReader::ReadAttributes ( const std::string &  filename,
tree::AttributeMapType attr 
) [virtual]

Read the attributes for a file.

Reimplemented from creaImageIO::AbstractImageReader.

Referenced by getAttributes().

Here is the caller graph for this function:

void creaImageIO::DicomImageReader::ReadAttributes2 ( const std::string &  filename,
tree::AttributeMapType attr 
)
vtkImageData * creaImageIO::DicomImageReader::ReadImage ( const std::string &  filename  )  [virtual]

return for a file a 2D VTkImage

Reimplemented from creaImageIO::AbstractImageReader.

Definition at line 56 of file creaImageIODicomImageReader.cpp.

References mReader.

  {
    vtkImageData* im = 0;
    try
      {
        mReader->SetFileName(filename.c_str());
        mReader->Update();
        im = vtkImageData::New();
        im->ShallowCopy(mReader->GetOutput());
      }
    catch (...)
      {
        if (im!=0) im->Delete();
          im = 0;
      }
    return im;
  }

virtual vtkImageData* creaImageIO::DicomImageReader::ReadImage ( const std::string &  filename  )  [virtual]

return for a file a 2D VTkImage

Reimplemented from creaImageIO::AbstractImageReader.

void creaImageIO::AbstractImageReader::SetName ( const std::string &  s  )  [inline, protected, inherited]

Set the reader's name.

Definition at line 36 of file creaImageIOAbstractImageReader.h.

Referenced by DicomImageReader(), creaImageIO::UltrasonixImageReader::UltrasonixImageReader(), and creaImageIO::VtkImageReader::VtkImageReader().

Here is the caller graph for this function:


Friends And Related Function Documentation

deleter [friend]

Definition at line 45 of file creaImageIODicomImageReader.h.


Member Data Documentation

Definition at line 49 of file creaImageIODicomImageReader2.h.

vtkGDCMImageReader* creaImageIO::DicomImageReader::mReader [private]

Definition at line 47 of file creaImageIODicomImageReader2.h.

vtkGdcmReader* creaImageIO::DicomImageReader::mReader [private]

Definition at line 40 of file creaImageIODicomImageReader.h.

Referenced by DicomImageReader(), ReadImage(), and ~DicomImageReader().

gdcm::Scanner creaImageIO::DicomImageReader::mscan [private]

Definition at line 48 of file creaImageIODicomImageReader2.h.


The documentation for this class was generated from the following files: