Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vtkGdcmWriter Class Reference

#include <vtkGdcmWriter.h>

List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkGdcmWriter, vtkImageWriter)
void PrintSelf (ostream &os, vtkIndent indent)
 vtkSetObjectMacro (LookupTable, vtkLookupTable)
 vtkGetObjectMacro (LookupTable, vtkLookupTable)
void SetWriteTypeToDcmImplVR ()
void SetWriteTypeToDcmExplVR ()
void SetWriteTypeToAcr ()
void SetWriteTypeToAcrLibido ()
 vtkSetMacro (WriteType, int)
 vtkGetMacro (WriteType, int)
const char * GetWriteTypeAsString ()

Static Public Member Functions

static vtkGdcmWriterNew ()

Protected Member Functions

 vtkGdcmWriter ()
 ~vtkGdcmWriter ()
virtual void RecursiveWrite (int axis, vtkImageData *image, ofstream *file)
virtual void RecursiveWrite (int axis, vtkImageData *image, vtkImageData *cache, ofstream *file)
void WriteDcmFile (char *fileName, vtkImageData *image)

Private Attributes

vtkLookupTable * LookupTable
int WriteType


Detailed Description

Definition at line 35 of file vtkGdcmWriter.h.


Constructor & Destructor Documentation

vtkGdcmWriter::vtkGdcmWriter  )  [protected]
 

vtkGdcmWriter::~vtkGdcmWriter  )  [protected]
 

Definition at line 46 of file vtkGdcmWriter.cxx.

00047 {
00048 }


Member Function Documentation

const char * vtkGdcmWriter::GetWriteTypeAsString  ) 
 

Definition at line 61 of file vtkGdcmWriter.cxx.

References VTK_GDCM_WRITE_TYPE_ACR, VTK_GDCM_WRITE_TYPE_ACR_LIBIDO, VTK_GDCM_WRITE_TYPE_EXPLICIT_VR, VTK_GDCM_WRITE_TYPE_IMPLICIT_VR, and WriteType.

Referenced by PrintSelf().

00062 {
00063    switch(WriteType)
00064    {
00065       case VTK_GDCM_WRITE_TYPE_EXPLICIT_VR :
00066          return "Explicit VR";
00067       case VTK_GDCM_WRITE_TYPE_IMPLICIT_VR :
00068          return "Implicit VR";
00069       case VTK_GDCM_WRITE_TYPE_ACR :
00070          return "ACR";
00071       case VTK_GDCM_WRITE_TYPE_ACR_LIBIDO :
00072          return "ACR Libido";
00073       default :
00074          return "Unknow type";
00075    }
00076 }

static vtkGdcmWriter* vtkGdcmWriter::New  )  [static]
 

Referenced by main().

void vtkGdcmWriter::PrintSelf ostream &  os,
vtkIndent  indent
 

Definition at line 52 of file vtkGdcmWriter.cxx.

References GetWriteTypeAsString().

00053 {
00054    this->Superclass::PrintSelf(os, indent);
00055 
00056    os << indent << "Write type : " << this->GetWriteTypeAsString();
00057 }

void vtkGdcmWriter::RecursiveWrite int  axis,
vtkImageData *  image,
vtkImageData *  cache,
ofstream *  file
[protected, virtual]
 

Definition at line 256 of file vtkGdcmWriter.cxx.

References RecursiveWrite(), and WriteDcmFile().

00258 {
00259    int idx, min, max;
00260 
00261    // if the file is already open then just write to it
00262    if( file )
00263    {
00264       vtkErrorMacro( <<  "File musn't be open");
00265       return;
00266    }
00267 
00268    // if we need to open another slice, do it
00269    if( (axis + 1) == this->FileDimensionality )
00270    {
00271       // determine the name
00272       if (this->FileName)
00273       {
00274          sprintf(this->InternalFileName, "%s", this->FileName);
00275       }
00276       else 
00277       {
00278          if (this->FilePrefix)
00279          {
00280             sprintf(this->InternalFileName, this->FilePattern, 
00281             this->FilePrefix, this->FileNumber);
00282          }
00283          else
00284          {
00285             sprintf(this->InternalFileName, this->FilePattern,this->FileNumber);
00286          }
00287 // Remove this code in case user is using VTK 4.2...
00288 #if !(VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION == 2)
00289          if (this->FileNumber < this->MinimumFileNumber)
00290          {
00291             this->MinimumFileNumber = this->FileNumber;
00292          }
00293          else if (this->FileNumber > this->MaximumFileNumber)
00294          {
00295             this->MaximumFileNumber = this->FileNumber;
00296          }
00297 #endif
00298       }
00299 
00300       // Write the file
00301       WriteDcmFile(this->InternalFileName,image);
00302       ++this->FileNumber;
00303       return;
00304    }
00305 
00306    // if the current region is too high a dimension for the file
00307    // the we will split the current axis
00308    cache->GetAxisUpdateExtent(axis, min, max);
00309 
00310    // if it is the y axis then flip by default
00311    if (axis == 1 && !this->FileLowerLeft)
00312    {
00313       for(idx = max; idx >= min; idx--)
00314       {
00315          cache->SetAxisUpdateExtent(axis, idx, idx);
00316          this->RecursiveWrite(axis - 1, cache, image, file);
00317       }
00318    }
00319    else
00320    {
00321       for(idx = min; idx <= max; idx++)
00322       {
00323          cache->SetAxisUpdateExtent(axis, idx, idx);
00324          this->RecursiveWrite(axis - 1, cache, image, file);
00325       }
00326    }
00327 
00328    // restore original extent
00329    cache->SetAxisUpdateExtent(axis, min, max);
00330 }

void vtkGdcmWriter::RecursiveWrite int  axis,
vtkImageData *  image,
ofstream *  file
[protected, virtual]
 

Write of the files The call to this method is recursive if there is some files to write

Definition at line 234 of file vtkGdcmWriter.cxx.

Referenced by RecursiveWrite().

00236 {
00237    if(file)
00238    {
00239       vtkErrorMacro( <<  "File must not be open");
00240       return;
00241    }
00242 
00243    if( image->GetScalarType() == VTK_FLOAT || 
00244        image->GetScalarType() == VTK_DOUBLE )
00245    {
00246       vtkErrorMacro(<< "Bad input type. Scalar type must not be of type "
00247                     << "VTK_FLOAT or VTKDOUBLE (found:"
00248                     << image->GetScalarTypeAsString());
00249       return;
00250    }
00251 
00252    RecursiveWrite(axis,image, image, file);
00253    //WriteDcmFile(this->FileName,image);
00254 }

void vtkGdcmWriter::SetWriteTypeToAcr  )  [inline]
 

Definition at line 48 of file vtkGdcmWriter.h.

References VTK_GDCM_WRITE_TYPE_ACR.

00048 {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR);        };

void vtkGdcmWriter::SetWriteTypeToAcrLibido  )  [inline]
 

Definition at line 49 of file vtkGdcmWriter.h.

References VTK_GDCM_WRITE_TYPE_ACR_LIBIDO.

00049 {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };

void vtkGdcmWriter::SetWriteTypeToDcmExplVR  )  [inline]
 

Definition at line 47 of file vtkGdcmWriter.h.

References VTK_GDCM_WRITE_TYPE_IMPLICIT_VR.

00047 {SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR);};

void vtkGdcmWriter::SetWriteTypeToDcmImplVR  )  [inline]
 

Definition at line 46 of file vtkGdcmWriter.h.

References VTK_GDCM_WRITE_TYPE_EXPLICIT_VR.

00046 {SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR);};

vtkGdcmWriter::vtkGetMacro WriteType  ,
int 
 

vtkGdcmWriter::vtkGetObjectMacro LookupTable  ,
vtkLookupTable 
 

vtkGdcmWriter::vtkSetMacro WriteType  ,
int 
 

vtkGdcmWriter::vtkSetObjectMacro LookupTable  ,
vtkLookupTable 
 

vtkGdcmWriter::vtkTypeRevisionMacro vtkGdcmWriter  ,
vtkImageWriter 
 

void vtkGdcmWriter::WriteDcmFile char *  fileName,
vtkImageData *  image
[protected]
 

Definition at line 332 of file vtkGdcmWriter.cxx.

References gdcm::RefCounter::Delete(), gdcm::FileHelper::GetUserData(), gdcm::FileHelper::GetUserDataSize(), gdcm::FileHelper::New(), SetImageInformation(), gdcm::FileHelper::SetWriteTypeToAcr(), gdcm::FileHelper::SetWriteTypeToAcrLibido(), gdcm::FileHelper::SetWriteTypeToDcmExplVR(), gdcm::FileHelper::SetWriteTypeToDcmImplVR(), VTK_GDCM_WRITE_TYPE_ACR, VTK_GDCM_WRITE_TYPE_ACR_LIBIDO, VTK_GDCM_WRITE_TYPE_EXPLICIT_VR, VTK_GDCM_WRITE_TYPE_IMPLICIT_VR, gdcm::FileHelper::Write(), and WriteType.

Referenced by RecursiveWrite().

00333 {
00334    // From here, the write of the file begins
00335    gdcm::FileHelper *dcmFile = gdcm::FileHelper::New();
00336 
00337    // Set the image informations
00338    SetImageInformation(dcmFile, image);
00339 
00340    // Write the image
00341    switch(this->WriteType)
00342    {
00343       case VTK_GDCM_WRITE_TYPE_EXPLICIT_VR :
00344          dcmFile->SetWriteTypeToDcmExplVR();
00345          break;
00346       case VTK_GDCM_WRITE_TYPE_IMPLICIT_VR :
00347          dcmFile->SetWriteTypeToDcmImplVR();
00348          break;
00349       case VTK_GDCM_WRITE_TYPE_ACR :
00350          dcmFile->SetWriteTypeToAcr();
00351          break;
00352       case VTK_GDCM_WRITE_TYPE_ACR_LIBIDO :
00353          dcmFile->SetWriteTypeToAcrLibido();
00354          break;
00355       default :
00356          dcmFile->SetWriteTypeToDcmExplVR();
00357    }
00358 
00359    if(!dcmFile->Write(fileName))
00360    {
00361       vtkErrorMacro( << "File "  <<  this->FileName  <<  "cannot be written by "
00362                      << " the gdcm library");
00363    }
00364 
00365    // Clean up
00366    if( dcmFile->GetUserData() && dcmFile->GetUserDataSize()>0 )
00367    {
00368       delete[] dcmFile->GetUserData();
00369    }
00370    dcmFile->Delete();
00371 }


Member Data Documentation

vtkLookupTable* vtkGdcmWriter::LookupTable [private]
 

Definition at line 65 of file vtkGdcmWriter.h.

int vtkGdcmWriter::WriteType [private]
 

Definition at line 66 of file vtkGdcmWriter.h.

Referenced by GetWriteTypeAsString(), and WriteDcmFile().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 10:15:00 2006 for gdcm by  doxygen 1.4.4