#include <vtkGdcmWriter.h>
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 () |
| void | SetUIDPrefix (const char *prefix) |
| const char * | GetUIDPrefix () |
| void | NewStudyInstanceUID () |
| void | NewSeriesInstanceUID () |
| void | NewFrameOfReferenceInstanceUID () |
Static Public Member Functions | |
| vtkGdcmWriter * | New () |
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 |
| std::string | UIDPrefix |
| std::string | StudyInstanceUID |
| std::string | SeriesInstanceUID |
| std::string | FrameOfReferenceInstanceUID |
|
|
Definition at line 35 of file vtkGdcmWriter.cxx. References FrameOfReferenceInstanceUID, SeriesInstanceUID, StudyInstanceUID, UIDPrefix, and VTK_GDCM_WRITE_TYPE_EXPLICIT_VR.
00036 {
00037 this->LookupTable = NULL;
00038 this->FileDimensionality = 3;
00039 this->WriteType = VTK_GDCM_WRITE_TYPE_EXPLICIT_VR;
00040
00041 UIDPrefix = "";
00042 StudyInstanceUID = "";
00043 SeriesInstanceUID = "";
00044 FrameOfReferenceInstanceUID = "";
00045 }
|
|
|
Definition at line 47 of file vtkGdcmWriter.cxx.
00048 {
00049 }
|
|
|
Definition at line 84 of file vtkGdcmWriter.cxx. References UIDPrefix.
00085 {
00086 return UIDPrefix.c_str();
00087 }
|
|
|
Definition at line 62 of file vtkGdcmWriter.cxx. References VTK_GDCM_WRITE_TYPE_ACR, VTK_GDCM_WRITE_TYPE_ACR_LIBIDO, VTK_GDCM_WRITE_TYPE_EXPLICIT_VR, and VTK_GDCM_WRITE_TYPE_IMPLICIT_VR. Referenced by PrintSelf().
00063 {
00064 switch(WriteType)
00065 {
00066 case VTK_GDCM_WRITE_TYPE_EXPLICIT_VR :
00067 return "Explicit VR";
00068 case VTK_GDCM_WRITE_TYPE_IMPLICIT_VR :
00069 return "Implicit VR";
00070 case VTK_GDCM_WRITE_TYPE_ACR :
00071 return "ACR";
00072 case VTK_GDCM_WRITE_TYPE_ACR_LIBIDO :
00073 return "ACR Libido";
00074 default :
00075 return "Unknow type";
00076 }
00077 }
|
|
|
Referenced by main(). |
|
|
Definition at line 99 of file vtkGdcmWriter.cxx. References FrameOfReferenceInstanceUID.
00100 {
00101 FrameOfReferenceInstanceUID = "";
00102 }
|
|
|
Definition at line 94 of file vtkGdcmWriter.cxx. References SeriesInstanceUID.
00095 {
00096 SeriesInstanceUID = "";
00097 }
|
|
|
Definition at line 89 of file vtkGdcmWriter.cxx. References StudyInstanceUID.
00090 {
00091 StudyInstanceUID = "";
00092 }
|
|
||||||||||||
|
Definition at line 53 of file vtkGdcmWriter.cxx. References GetWriteTypeAsString().
00054 {
00055 this->Superclass::PrintSelf(os,indent);
00056
00057 os << indent << "Write type : " << this->GetWriteTypeAsString();
00058 }
|
|
||||||||||||||||||||
|
Definition at line 270 of file vtkGdcmWriter.cxx. References RecursiveWrite(), and WriteDcmFile().
00272 {
00273 int idx, min, max;
00274
00275 // if the file is already open then just write to it
00276 if( file )
00277 {
00278 vtkErrorMacro( << "File musn't be opened");
00279 return;
00280 }
00281
00282 // if we need to open another slice, do it
00283 if( (axis + 1) == this->FileDimensionality )
00284 {
00285 // determine the name
00286 if (this->FileName)
00287 {
00288 sprintf(this->InternalFileName,"%s",this->FileName);
00289 }
00290 else
00291 {
00292 if (this->FilePrefix)
00293 {
00294 sprintf(this->InternalFileName, this->FilePattern,
00295 this->FilePrefix, this->FileNumber);
00296 }
00297 else
00298 {
00299 sprintf(this->InternalFileName, this->FilePattern,this->FileNumber);
00300 }
00301 if (this->FileNumber < this->MinimumFileNumber)
00302 {
00303 this->MinimumFileNumber = this->FileNumber;
00304 }
00305 else if (this->FileNumber > this->MaximumFileNumber)
00306 {
00307 this->MaximumFileNumber = this->FileNumber;
00308 }
00309 }
00310
00311 // Write the file
00312 WriteDcmFile(this->InternalFileName,image);
00313 ++this->FileNumber;
00314 return;
00315 }
00316
00317 // if the current region is too high a dimension forthe file
00318 // the we will split the current axis
00319 cache->GetAxisUpdateExtent(axis, min, max);
00320
00321 // if it is the y axis then flip by default
00322 if (axis == 1 && !this->FileLowerLeft)
00323 {
00324 for(idx = max; idx >= min; idx--)
00325 {
00326 cache->SetAxisUpdateExtent(axis, idx, idx);
00327 this->RecursiveWrite(axis - 1, cache, image, file);
00328 }
00329 }
00330 else
00331 {
00332 for(idx = min; idx <= max; idx++)
00333 {
00334 cache->SetAxisUpdateExtent(axis, idx, idx);
00335 this->RecursiveWrite(axis - 1, cache, image, file);
00336 }
00337 }
00338
00339 // restore original extent
00340 cache->SetAxisUpdateExtent(axis, min, max);
00341 }
|
|
||||||||||||||||
|
Write of the files The call to this method is recursive if there is some files to write Definition at line 249 of file vtkGdcmWriter.cxx. Referenced by RecursiveWrite().
00250 {
00251 if(file)
00252 {
00253 vtkErrorMacro( << "File musn't be opened");
00254 return;
00255 }
00256
00257 if( image->GetScalarType() == VTK_FLOAT ||
00258 image->GetScalarType() == VTK_DOUBLE )
00259 {
00260 vtkErrorMacro(<< "Bad input type. Scalar type musn't be of type "
00261 << "VTK_FLOAT or VTKDOUBLE (found:"
00262 << image->GetScalarTypeAsString());
00263 return;
00264 }
00265
00266 RecursiveWrite(axis,image,image,file);
00267 //WriteDcmFile(this->FileName,image);
00268 }
|
|
|
Definition at line 79 of file vtkGdcmWriter.cxx. References UIDPrefix.
00080 {
00081 UIDPrefix = prefix;
00082 }
|
|
|
Definition at line 48 of file vtkGdcmWriter.h. References VTK_GDCM_WRITE_TYPE_ACR.
00048 { SetWriteType(VTK_GDCM_WRITE_TYPE_ACR); };
|
|
|
Definition at line 49 of file vtkGdcmWriter.h. References VTK_GDCM_WRITE_TYPE_ACR_LIBIDO.
00049 { SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };
|
|
|
Definition at line 47 of file vtkGdcmWriter.h. References VTK_GDCM_WRITE_TYPE_IMPLICIT_VR.
00047 { SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR); };
|
|
|
Definition at line 46 of file vtkGdcmWriter.h. References VTK_GDCM_WRITE_TYPE_EXPLICIT_VR.
00046 { SetWriteType(VTK_GDCM_WRITE_TYPE_EXPLICIT_VR); };
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 343 of file vtkGdcmWriter.cxx. References gdcm::Util::CreateUniqueUID(), FrameOfReferenceInstanceUID, gdcm::FileHelper::GetUserData(), gdcm::FileHelper::GetUserDataSize(), gdcm::FileHelper::InsertValEntry(), SeriesInstanceUID, SetImageInformation(), gdcm::FileHelper::SetWriteTypeToAcr(), gdcm::FileHelper::SetWriteTypeToAcrLibido(), gdcm::FileHelper::SetWriteTypeToDcmExplVR(), gdcm::FileHelper::SetWriteTypeToDcmImplVR(), StudyInstanceUID, UIDPrefix, VTK_GDCM_WRITE_TYPE_ACR, VTK_GDCM_WRITE_TYPE_ACR_LIBIDO, VTK_GDCM_WRITE_TYPE_EXPLICIT_VR, VTK_GDCM_WRITE_TYPE_IMPLICIT_VR, and gdcm::FileHelper::Write(). Referenced by RecursiveWrite().
00344 {
00345 // From here, the write of the file begins
00346 gdcm::FileHelper *dcmFile = new gdcm::FileHelper();
00347
00348 // Set the image UID
00349 if( StudyInstanceUID.empty() )
00350 StudyInstanceUID = gdcm::Util::CreateUniqueUID( UIDPrefix );
00351 if( SeriesInstanceUID.empty() )
00352 SeriesInstanceUID = gdcm::Util::CreateUniqueUID( UIDPrefix );
00353 if( FrameOfReferenceInstanceUID.empty() )
00354 FrameOfReferenceInstanceUID = gdcm::Util::CreateUniqueUID( UIDPrefix );
00355 std::string uid = gdcm::Util::CreateUniqueUID( UIDPrefix );
00356
00357 dcmFile->InsertValEntry(uid,0x0008,0x0018); //[SOP Instance UID]
00358 dcmFile->InsertValEntry(uid,0x0002,0x0003); //[Media Stored SOP Instance UID]
00359 dcmFile->InsertValEntry(StudyInstanceUID,0x0020,0x000d); //[Study Instance UID]
00360 dcmFile->InsertValEntry(SeriesInstanceUID,0x0020,0x000e); //[Series Instance UID]
00361 dcmFile->InsertValEntry(FrameOfReferenceInstanceUID,0x0020, 0x0052); //[Frame of Reference UID]
00362
00363 // Set the image informations
00364 SetImageInformation(dcmFile,image);
00365
00366 // Write the image
00367 switch(this->WriteType)
00368 {
00369 case VTK_GDCM_WRITE_TYPE_EXPLICIT_VR :
00370 dcmFile->SetWriteTypeToDcmExplVR();
00371 break;
00372 case VTK_GDCM_WRITE_TYPE_IMPLICIT_VR :
00373 dcmFile->SetWriteTypeToDcmImplVR();
00374 break;
00375 case VTK_GDCM_WRITE_TYPE_ACR :
00376 dcmFile->SetWriteTypeToAcr();
00377 break;
00378 case VTK_GDCM_WRITE_TYPE_ACR_LIBIDO :
00379 dcmFile->SetWriteTypeToAcrLibido();
00380 break;
00381 default :
00382 dcmFile->SetWriteTypeToDcmExplVR();
00383 }
00384
00385 if(!dcmFile->Write(fileName))
00386 {
00387 vtkErrorMacro( << "File " << this->FileName << "couldn't be written by "
00388 << " the gdcm library");
00389 }
00390
00391 // Clean up
00392 if( dcmFile->GetUserData() && dcmFile->GetUserDataSize()>0 )
00393 {
00394 delete[] dcmFile->GetUserData();
00395 }
00396 delete dcmFile;
00397 }
|
|
|
Definition at line 79 of file vtkGdcmWriter.h. Referenced by NewFrameOfReferenceInstanceUID(), vtkGdcmWriter(), and WriteDcmFile(). |
|
|
Definition at line 72 of file vtkGdcmWriter.h. |
|
|
Definition at line 78 of file vtkGdcmWriter.h. Referenced by NewSeriesInstanceUID(), vtkGdcmWriter(), and WriteDcmFile(). |
|
|
Definition at line 77 of file vtkGdcmWriter.h. Referenced by NewStudyInstanceUID(), vtkGdcmWriter(), and WriteDcmFile(). |
|
|
Definition at line 76 of file vtkGdcmWriter.h. Referenced by GetUIDPrefix(), SetUIDPrefix(), vtkGdcmWriter(), and WriteDcmFile(). |
|
|
Definition at line 73 of file vtkGdcmWriter.h. |
1.3.6