#include <vtkGdcmReader.h>
Public Member Functions | |
vtkTypeRevisionMacro (vtkGdcmReader, vtkImageReader) | |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual void | RemoveAllFileName (void) |
virtual void | AddFileName (const char *name) |
virtual void | SetFileName (const char *name) |
void | SetCoherentFileList (std::vector< GDCM_NAME_SPACE::File * > *cfl) |
void | SetUserFunction (VOID_FUNCTION_PUINT8_PFILE_POINTER userFunc) |
vtkSetMacro (AllowLookupTable, bool) | |
vtkGetMacro (AllowLookupTable, bool) | |
vtkBooleanMacro (AllowLookupTable, bool) | |
vtkGetObjectMacro (LookupTable, vtkLookupTable) | |
vtkSetMacro (LoadMode, int) | |
vtkGetMacro (LoadMode, int) | |
vtkBooleanMacro (LoadMode, int) | |
vtkSetMacro (DropDuplicatePositions, bool) | |
vtkGetMacro (DropDuplicatePositions, bool) | |
vtkBooleanMacro (DropDuplicatePositions, bool) | |
Static Public Member Functions | |
static vtkGdcmReader * | New () |
Protected Member Functions | |
vtkGdcmReader () | |
~vtkGdcmReader () | |
virtual void | ExecuteInformation () |
virtual void | ExecuteData (vtkDataObject *output) |
virtual void | BuildFileListFromPattern () |
virtual void | LoadFileInformation () |
virtual void | UpdateFileInformation () |
virtual void | GetFileInformation (GDCM_NAME_SPACE::File *file) |
virtual bool | TestFileInformation (GDCM_NAME_SPACE::File *file) |
Private Types | |
typedef std::vector< GDCM_NAME_SPACE::File * > | gdcmFileList |
Private Member Functions | |
void | RemoveAllInternalFileName (void) |
void | AddInternalFileName (const char *name) |
void | RemoveAllInternalFile (void) |
void | IncrementProgress (const unsigned long updateProgressTarget, unsigned long &updateProgressCount) |
void | LoadImageInMemory (GDCM_NAME_SPACE::File *f, unsigned char *dest, const unsigned long updateProgressTarget, unsigned long &updateProgressCount) |
Private Attributes | |
vtkLookupTable * | LookupTable |
vtkTimeStamp | fileTime |
bool | AllowLookupTable |
bool | AllowLightChecking |
int | NumColumns |
int | NumLines |
int | NumPlanes |
int | TotalNumberOfPlanes |
int | NumComponents |
std::string | ImageType |
size_t | PixelSize |
std::list< std::string > | FileNameList |
gdcmFileList * | CoherentFileList |
bool | OwnFile |
std::list< std::string > | InternalFileNameList |
gdcmFileList | InternalFileList |
int | LoadMode |
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Bit 2 : Skip Sequences inside a Shadow Group, if possible Probabely (?), some more to add. | |
bool | DropDuplicatePositions |
VOID_FUNCTION_PUINT8_PFILE_POINTER | UserFunction |
Pointer to a user suplied function to allow modification of pixel order. |
Definition at line 36 of file vtkGdcmReader.h.
|
Definition at line 132 of file vtkGdcmReader.h. |
|
|
|
Definition at line 116 of file vtkGdcmReader.cxx. References InternalFileNameList, LookupTable, and RemoveAllFileName(). 00117 { 00118 this->RemoveAllFileName(); 00119 this->InternalFileNameList.clear(); 00120 if(this->LookupTable) 00121 this->LookupTable->Delete(); 00122 }
|
|
Definition at line 153 of file vtkGdcmReader.cxx. References FileNameList. Referenced by main(). 00154 { 00155 // We need to bypass the const pointer [since list<>.push_bash() only 00156 // takes a char* (but not a const char*)] by making a local copy: 00157 this->FileNameList.push_back(name); 00158 this->Modified(); 00159 }
|
|
Definition at line 716 of file vtkGdcmReader.cxx. References InternalFileNameList. 00717 { 00718 char *LocalName = new char[strlen(name) + 1]; 00719 strcpy(LocalName, name); 00720 this->InternalFileNameList.push_back(LocalName); 00721 delete[] LocalName; 00722 }
|
|
Definition at line 394 of file vtkGdcmReader.cxx. References FileNameList, InternalFileNameList, and RemoveAllInternalFileName(). Referenced by ExecuteInformation(). 00395 { 00396 this->RemoveAllInternalFileName(); 00397 00398 // Test miscellanous cases 00399 if ((! this->FileNameList.empty()) && this->FileName ) 00400 { 00401 vtkErrorMacro(<< "Both AddFileName and SetFileName schemes were used"); 00402 vtkErrorMacro(<< "No images loaded ! "); 00403 return; 00404 } 00405 00406 if ((! this->FileNameList.empty()) && this->FilePrefix ) 00407 { 00408 vtkErrorMacro(<< "Both AddFileName and SetFilePrefix schemes were used"); 00409 vtkErrorMacro(<< "No images loaded ! "); 00410 return; 00411 } 00412 00413 if (this->FileName && this->FilePrefix) 00414 { 00415 vtkErrorMacro(<< "Both SetFileName and SetFilePrefix schemes were used"); 00416 vtkErrorMacro(<< "No images loaded ! "); 00417 return; 00418 } 00419 00420 // Create the InternalFileNameList 00421 if (! this->FileNameList.empty() ) 00422 { 00423 vtkDebugMacro(<< "Using the AddFileName specified files"); 00424 this->InternalFileNameList=this->FileNameList; 00425 return; 00426 } 00427 00428 if (!this->FileName && !this->FilePrefix) 00429 { 00430 vtkErrorMacro(<< "FileNames are not set. Either use AddFileName() or"); 00431 vtkErrorMacro(<< "specify a FileName or FilePrefix."); 00432 return; 00433 } 00434 00435 if( this->FileName ) 00436 { 00437 // Single file loading (as given with ::SetFileName()): 00438 // Case of multi-frame file considered here 00439 this->ComputeInternalFileName(this->DataExtent[4]); 00440 vtkDebugMacro(<< "Adding file " << this->InternalFileName); 00441 this->AddInternalFileName(this->InternalFileName); 00442 } 00443 else 00444 { 00445 // Multi file loading (as given with ::SetFilePattern()): 00446 for (int idx = this->DataExtent[4]; idx <= this->DataExtent[5]; ++idx) 00447 { 00448 this->ComputeInternalFileName(idx); 00449 vtkDebugMacro(<< "Adding file " << this->InternalFileName); 00450 this->AddInternalFileName(this->InternalFileName); 00451 } 00452 } 00453 }
|
|
Definition at line 308 of file vtkGdcmReader.cxx. 00309 { 00310 vtkImageData *data=vtkImageData::SafeDownCast(output); 00311 data->SetExtent(this->DataExtent); 00312 00313 /* if ( CoherentFileList != 0 ) // When a list of names is passed 00314 { 00315 if (this->CoherentFileList->empty()) 00316 { 00317 vtkErrorMacro(<< "Coherent File List must have at least a valid File*."); 00318 return; 00319 } 00320 } 00321 else if (this->InternalFileNameList.empty()) 00322 { 00323 vtkErrorMacro(<< "A least a valid FileName must be specified."); 00324 return; 00325 } 00326 */ 00327 00328 // data->AllocateScalars(); // For VTK5.0 00329 // if (this->UpdateExtentIsEmpty(output)) 00330 // { 00331 // return; 00332 // } 00333 //} // end For VTK5.0 00334 00335 data->AllocateScalars(); // For VTK5.0 00336 if (this->UpdateExtentIsEmpty(output)) 00337 { 00338 return; 00339 } 00340 00341 //void vtkGdcmReader::BuildData(vtkDataObject *output) // For VTK5.0 00342 //{ 00343 // vtkImageData *data = this->AllocateOutputData(output); // end For VTK5.0 00344 00345 data->GetPointData()->GetScalars()->SetName("DicomImage-Volume"); 00346 00347 // Test if output has valid extent 00348 // Prevent memory errors 00349 if((this->DataExtent[1]-this->DataExtent[0]>=0) && 00350 (this->DataExtent[3]-this->DataExtent[2]>=0) && 00351 (this->DataExtent[5]-this->DataExtent[4]>=0)) 00352 { 00353 // The memory size for a full stack of images of course depends 00354 // on the number of planes and the size of each image: 00355 //size_t StackNumPixels = this->NumColumns * this->NumLines 00356 // * this->TotalNumberOfPlanes * this->NumComponents; 00357 //size_t stack_size = StackNumPixels * this->PixelSize; //not used 00358 // Allocate pixel data space itself. 00359 00360 // Variables for the UpdateProgress. We shall use 50 steps to signify 00361 // the advance of the process: 00362 unsigned long UpdateProgressTarget = (unsigned long) ceil (this->NumLines 00363 * this->TotalNumberOfPlanes 00364 / 50.0); 00365 // The actual advance measure: 00366 unsigned long UpdateProgressCount = 0; 00367 00368 // Filling the allocated memory space with each image/volume: 00369 00370 size_t size = this->NumColumns * this->NumLines * this->NumPlanes 00371 * data->GetScalarSize() * this->NumComponents; 00372 unsigned char *Dest = (unsigned char *)data->GetScalarPointer(); 00373 for (std::vector<GDCM_NAME_SPACE::File* >::iterator it = InternalFileList.begin(); 00374 it != InternalFileList.end(); 00375 ++it) 00376 { 00377 this->LoadImageInMemory(*it, Dest, 00378 UpdateProgressTarget, 00379 UpdateProgressCount); 00380 Dest += size; 00381 } 00382 } 00383 this->RemoveAllInternalFile(); // For VTK5.0 00384 }
|
|
Definition at line 180 of file vtkGdcmReader.cxx. References BuildFileListFromPattern(), fileTime, ImageType, LoadFileInformation(), NumColumns, NumLines, RemoveAllInternalFile(), TotalNumberOfPlanes, and UpdateFileInformation(). 00181 { 00182 // if(this->Execution) // For VTK5.0 00183 // return; 00184 // 00185 // this->Execution=true; // end For VTK5.0 00186 this->RemoveAllInternalFile(); 00187 if(this->MTime>this->fileTime) 00188 { 00189 this->TotalNumberOfPlanes = 0; 00190 00191 if ( this->CoherentFileList != 0 ) 00192 { 00193 this->UpdateFileInformation(); 00194 } 00195 else 00196 { 00197 this->BuildFileListFromPattern(); 00198 this->LoadFileInformation(); 00199 } 00200 00201 if ( this->TotalNumberOfPlanes == 0) 00202 { 00203 vtkErrorMacro(<< "File set is not coherent. Exiting..."); 00204 return; 00205 } 00206 00207 // if the user has not set the extent, but has set the VOI 00208 // set the z axis extent to the VOI z axis 00209 if (this->DataExtent[4]==0 && this->DataExtent[5] == 0 && 00210 (this->DataVOI[4] || this->DataVOI[5])) 00211 { 00212 this->DataExtent[4] = this->DataVOI[4]; 00213 this->DataExtent[5] = this->DataVOI[5]; 00214 } 00215 00216 // When the user has set the VOI, check it's coherence with the file content. 00217 if (this->DataVOI[0] || this->DataVOI[1] || 00218 this->DataVOI[2] || this->DataVOI[3] || 00219 this->DataVOI[4] || this->DataVOI[5]) 00220 { 00221 if ((this->DataVOI[0] < 0) || 00222 (this->DataVOI[1] >= this->NumColumns) || 00223 (this->DataVOI[2] < 0) || 00224 (this->DataVOI[3] >= this->NumLines) || 00225 (this->DataVOI[4] < 0) || 00226 (this->DataVOI[5] >= this->TotalNumberOfPlanes )) 00227 { 00228 vtkWarningMacro(<< "The requested VOI is larger than expected extent."); 00229 this->DataVOI[0] = 0; 00230 this->DataVOI[1] = this->NumColumns - 1; 00231 this->DataVOI[2] = 0; 00232 this->DataVOI[3] = this->NumLines - 1; 00233 this->DataVOI[4] = 0; 00234 this->DataVOI[5] = this->TotalNumberOfPlanes - 1; 00235 } 00236 } 00237 00238 // Set the Extents. 00239 this->DataExtent[0] = 0; 00240 this->DataExtent[1] = this->NumColumns - 1; 00241 this->DataExtent[2] = 0; 00242 this->DataExtent[3] = this->NumLines - 1; 00243 this->DataExtent[4] = 0; 00244 this->DataExtent[5] = this->TotalNumberOfPlanes - 1; 00245 00246 // We don't need to set the Endian related stuff (by using 00247 // this->SetDataByteOrderToBigEndian() or SetDataByteOrderToLittleEndian() 00248 // since the reading of the file is done by gdcm. 00249 // But we do need to set up the data type for downstream filters: 00250 if ( ImageType == "8U" ) 00251 { 00252 vtkDebugMacro(<< "8 bits unsigned image"); 00253 this->SetDataScalarTypeToUnsignedChar(); 00254 } 00255 else if ( ImageType == "8S" ) 00256 { 00257 vtkErrorMacro(<< "Cannot handle 8 bit signed files"); 00258 return; 00259 } 00260 else if ( ImageType == "16U" ) 00261 { 00262 vtkDebugMacro(<< "16 bits unsigned image"); 00263 this->SetDataScalarTypeToUnsignedShort(); 00264 } 00265 else if ( ImageType == "16S" ) 00266 { 00267 vtkDebugMacro(<< "16 bits signed image"); 00268 this->SetDataScalarTypeToShort(); 00269 } 00270 else if ( ImageType == "32U" ) 00271 { 00272 vtkDebugMacro(<< "32 bits unsigned image"); 00273 vtkDebugMacro(<< "WARNING: forced to signed int !"); 00274 this->SetDataScalarTypeToInt(); 00275 } 00276 else if ( ImageType == "32S" ) 00277 { 00278 vtkDebugMacro(<< "32 bits signed image"); 00279 this->SetDataScalarTypeToInt(); 00280 } 00281 else if ( ImageType == "FD" ) 00282 { 00283 vtkDebugMacro(<< "64 bits Double image"); 00284 this->SetDataScalarTypeToDouble(); 00285 } 00286 //Set number of scalar components: 00287 this->SetNumberOfScalarComponents(this->NumComponents); 00288 00289 this->fileTime=this->MTime; 00290 } 00291 00292 this->Superclass::ExecuteInformation(); 00293 00294 //this->GetOutput()->SetUpdateExtentToWholeExtent();// For VTK5.0 00295 //this->BuildData(this->GetOutput()); 00296 00297 //this->Execution=false; 00298 //this->RemoveAllInternalFile(); // End For VTK5.0 00299 }
|
|
Get the informations from a file. These informations are required to specify the output image caracteristics Definition at line 573 of file vtkGdcmReader.cxx. References AllowLookupTable, CoherentFileList, GDCM_NAME_SPACE::RefCounter::Delete(), GDCM_NAME_SPACE::File::GetNumberOfScalarComponentsRaw(), GDCM_NAME_SPACE::File::GetPixelSize(), GDCM_NAME_SPACE::File::GetPixelType(), GDCM_NAME_SPACE::File::GetXSize(), GDCM_NAME_SPACE::File::GetXSpacing(), GDCM_NAME_SPACE::File::GetYSize(), GDCM_NAME_SPACE::File::GetYSpacing(), GDCM_NAME_SPACE::File::GetZSize(), GDCM_NAME_SPACE::SerieHelper::GetZSpacing(), GDCM_NAME_SPACE::File::GetZSpacing(), GDCM_NAME_SPACE::File::HasLUT(), ImageType, InternalFileNameList, GDCM_NAME_SPACE::SerieHelper::New(), NumColumns, NumLines, NumPlanes, GDCM_NAME_SPACE::SerieHelper::OrderFileList(), PixelSize, and TotalNumberOfPlanes. Referenced by UpdateFileInformation(). 00574 { 00575 // Get the image caracteristics 00576 this->NumColumns = file->GetXSize(); 00577 this->NumLines = file->GetYSize(); 00578 this->NumPlanes = file->GetZSize(); 00579 00580 if (CoherentFileList == 0) 00581 this->TotalNumberOfPlanes = this->NumPlanes*InternalFileNameList.size(); 00582 else 00583 this->TotalNumberOfPlanes = this->NumPlanes*CoherentFileList->size(); 00584 00585 this->ImageType = file->GetPixelType(); 00586 this->PixelSize = file->GetPixelSize(); 00587 00588 this->DataSpacing[0] = file->GetXSpacing(); 00589 this->DataSpacing[1] = file->GetYSpacing(); 00590 00591 // Most of the file headers have NO z spacing 00592 // It must be calculated from the whole GDCM_NAME_SPACE::Serie (if any) 00593 // using Jolinda Smith's algoritm. 00594 // see GDCM_NAME_SPACE::SerieHelper::ImagePositionPatientOrdering() 00595 if (CoherentFileList == 0) 00596 this->DataSpacing[2] = file->GetZSpacing(); 00597 else 00598 { 00599 // Just because OrderFileList() is a member of GDCM_NAME_SPACE::SerieHelper 00600 // we need to instanciate sh. 00601 GDCM_NAME_SPACE::SerieHelper *sh = GDCM_NAME_SPACE::SerieHelper::New(); 00602 sh->OrderFileList(CoherentFileList); // calls ImagePositionPatientOrdering() 00603 this->DataSpacing[2] = sh->GetZSpacing(); 00604 sh->Delete(); 00605 } 00606 00607 // Get the image data caracteristics 00608 if( file->HasLUT() && this->AllowLookupTable ) 00609 { 00610 // I could raise an error is AllowLookupTable is on and HasLUT() off 00611 this->NumComponents = file->GetNumberOfScalarComponentsRaw(); 00612 } 00613 else 00614 { 00615 this->NumComponents = file->GetNumberOfScalarComponents(); //rgb or mono 00616 } 00617 }
|
|
Definition at line 741 of file vtkGdcmReader.cxx. References NumLines. 00743 { 00744 // Update progress related for bad files: 00745 updateProgressCount += this->NumLines; 00746 if (updateProgressTarget > 0) 00747 { 00748 if (!(updateProgressCount%updateProgressTarget)) 00749 { 00750 this->UpdateProgress( 00751 updateProgressCount/(50.0*updateProgressTarget)); 00752 } 00753 } 00754 }
|
|
Load all the files and set it in the InternalFileList For each file, the readability and the coherence of image caracteristics are tested. If an image doesn't agree the required specifications, it isn't considered and no data will be set for the planes corresponding to this image The source of this work is the list of file name generated by the BuildFileListFromPattern method Definition at line 465 of file vtkGdcmReader.cxx. References GDCM_NAME_SPACE::RefCounter::Delete(), InternalFileList, InternalFileNameList, GDCM_NAME_SPACE::File::IsReadable(), GDCM_NAME_SPACE::File::Load(), LoadMode, GDCM_NAME_SPACE::File::New(), OwnFile, GDCM_NAME_SPACE::Document::SetFileName(), and GDCM_NAME_SPACE::Document::SetLoadMode(). Referenced by ExecuteInformation(). 00466 { 00467 GDCM_NAME_SPACE::File *file; 00468 bool foundReference=false; 00469 std::string type; 00470 00471 this->OwnFile=true; 00472 for (std::list<std::string>::iterator filename = InternalFileNameList.begin(); 00473 filename != InternalFileNameList.end(); 00474 ++filename) 00475 { 00476 // check for file readability 00477 FILE *fp; 00478 fp = fopen(filename->c_str(),"rb"); 00479 if (!fp) 00480 { 00481 vtkErrorMacro(<< "Unable to open file " << filename->c_str()); 00482 vtkErrorMacro(<< "Removing this file from read files: " 00483 << filename->c_str()); 00484 file = NULL; 00485 InternalFileList.push_back(file); 00486 continue; 00487 } 00488 fclose(fp); 00489 00490 // Read the file 00491 file=GDCM_NAME_SPACE::File::New(); 00492 file->SetLoadMode( LoadMode ); 00493 file->SetFileName(filename->c_str() ); 00494 file->Load(); 00495 00496 // Test the Dicom file readability 00497 if(!file->IsReadable()) 00498 { 00499 vtkErrorMacro(<< "Gdcm cannot parse file " << filename->c_str()); 00500 vtkErrorMacro(<< "Removing this file from read files: " 00501 << filename->c_str()); 00502 file->Delete(); 00503 file=NULL; 00504 InternalFileList.push_back(file); 00505 continue; 00506 } 00507 00508 // Test the Pixel Type recognition 00509 type = file->GetPixelType(); 00510 if ( (type != "8U") && (type != "8S") 00511 && (type != "16U") && (type != "16S") 00512 && (type != "32U") && (type != "32S") ) 00513 { 00514 vtkErrorMacro(<< "Bad File Type for file " << filename->c_str() << "\n" 00515 << " File type found : " << type.c_str() 00516 << " (might be 8U, 8S, 16U, 16S, 32U, 32S) \n" 00517 << " Removing this file from read files"); 00518 file->Delete(); 00519 file=NULL; 00520 InternalFileList.push_back(file); 00521 continue; 00522 } 00523 00524 // Test the image informations 00525 if(!foundReference) 00526 { 00527 foundReference = true; 00528 GetFileInformation(file); 00529 00530 vtkDebugMacro(<< "This file taken as coherence reference:" 00531 << filename->c_str()); 00532 vtkDebugMacro(<< "Image dimensions of reference file as read from Gdcm:" 00533 << this->NumColumns << " " << this->NumLines << " " 00534 << this->NumPlanes); 00535 } 00536 else if(!TestFileInformation(file)) 00537 { 00538 file->Delete(); 00539 file=NULL; 00540 } 00541 00542 InternalFileList.push_back(file); 00543 } 00544 }
|
|
Definition at line 787 of file vtkGdcmReader.cxx. References AllowLookupTable, GDCM_NAME_SPACE::FileHelper::GetFile(), GDCM_NAME_SPACE::Document::GetFileName(), GDCM_NAME_SPACE::FileHelper::GetImageDataRaw(), GDCM_NAME_SPACE::FileHelper::GetImageDataSize(), GDCM_NAME_SPACE::FileHelper::GetLutRGBA(), GDCM_NAME_SPACE::File::GetNumberOfScalarComponents(), GDCM_NAME_SPACE::File::GetNumberOfScalarComponentsRaw(), GDCM_NAME_SPACE::File::GetPixelSize(), GDCM_NAME_SPACE::File::GetXSize(), GDCM_NAME_SPACE::File::GetYSize(), GDCM_NAME_SPACE::File::GetZSize(), GDCM_NAME_SPACE::File::HasLUT(), LookupTable, GDCM_NAME_SPACE::FileHelper::New(), NumComponents, GDCM_NAME_SPACE::FileHelper::SetUserFunction(), and UserFunction. 00792 { 00793 if(!f) 00794 return; 00795 00796 GDCM_NAME_SPACE::FileHelper *fileH = GDCM_NAME_SPACE::FileHelper::New( f ); 00797 fileH->SetUserFunction( UserFunction ); 00798 00799 int numColumns = f->GetXSize(); 00800 int numLines = f->GetYSize(); 00801 int numPlanes = f->GetZSize(); 00802 int numComponents; 00803 00804 if( f->HasLUT() && this->AllowLookupTable ) 00805 numComponents = f->GetNumberOfScalarComponentsRaw(); 00806 else 00807 numComponents = f->GetNumberOfScalarComponents(); //rgb or mono 00808 vtkDebugMacro(<< "numComponents:" << numComponents); 00809 vtkDebugMacro(<< "Copying to memory image [" << f->GetFileName().c_str() << "]"); 00810 //size_t size; 00811 00812 // If the data structure of vtk for image/volume representation 00813 // were straigthforwards the following would be enough: 00814 // GdcmFile.GetImageDataIntoVector((void*)Dest, size); 00815 // But vtk chooses to invert the lines of an image, that is the last 00816 // line comes first (for some axis related reasons?). Hence we need 00817 // to load the image line by line, starting from the end. 00818 00819 int lineSize = NumComponents * numColumns * f->GetPixelSize(); 00820 int planeSize = lineSize * numLines; 00821 00822 unsigned char *src; 00823 00824 if( fileH->GetFile()->HasLUT() && AllowLookupTable ) 00825 { 00826 // to avoid bcc 5.5 w 00827 /*size = */ fileH->GetImageDataSize(); 00828 src = (unsigned char*) fileH->GetImageDataRaw(); 00829 unsigned char *lut = (unsigned char*) fileH->GetLutRGBA(); 00830 00831 if(!this->LookupTable) 00832 { 00833 this->LookupTable = vtkLookupTable::New(); 00834 } 00835 00836 this->LookupTable->SetNumberOfTableValues(256); 00837 for (int tmp=0; tmp<256; tmp++) 00838 { 00839 this->LookupTable->SetTableValue(tmp, 00840 (float)lut[4*tmp+0]/255.0, 00841 (float)lut[4*tmp+1]/255.0, 00842 (float)lut[4*tmp+2]/255.0, 00843 1); 00844 } 00845 this->LookupTable->SetRange(0,255); 00846 vtkDataSetAttributes *a = this->GetOutput()->GetPointData(); 00847 a->GetScalars()->SetLookupTable(this->LookupTable); 00848 free(lut); 00849 } 00850 else 00851 { 00852 //size = fileH->GetImageDataSize(); 00853 // useless - just an accessor; 'size' unused 00854 src = (unsigned char*)fileH->GetImageData(); 00855 } 00856 00857 unsigned char *dst = dest + planeSize - lineSize; 00858 for (int plane = 0; plane < numPlanes; plane++) 00859 { 00860 for (int line = 0; line < numLines; line++) 00861 { 00862 // Copy one line at proper destination: 00863 memcpy((void*)dst, (void*)src, lineSize); 00864 src += lineSize; 00865 dst -= lineSize; 00866 // Update progress related: 00867 if (!(updateProgressCount%updateProgressTarget)) 00868 { 00869 this->UpdateProgress( 00870 updateProgressCount/(50.0*updateProgressTarget)); 00871 } 00872 updateProgressCount++; 00873 } 00874 dst += 2 * planeSize; 00875 } 00876 00877 fileH->Delete(); 00878 }
|
|
Referenced by main(). |
|
Definition at line 126 of file vtkGdcmReader.cxx. References FileNameList. 00127 { 00128 this->Superclass::PrintSelf(os,indent); 00129 os << indent << "Filenames : " << endl; 00130 vtkIndent nextIndent = indent.GetNextIndent(); 00131 for (std::list<std::string>::iterator it = FileNameList.begin(); 00132 it != FileNameList.end(); 00133 ++it) 00134 { 00135 os << nextIndent << it->c_str() << endl ; 00136 } 00137 }
|
|
Definition at line 144 of file vtkGdcmReader.cxx. References FileNameList. Referenced by ~vtkGdcmReader(). 00145 { 00146 this->FileNameList.clear(); 00147 this->Modified(); 00148 }
|
|
Definition at line 727 of file vtkGdcmReader.cxx. References InternalFileList. Referenced by ExecuteInformation(). 00728 { 00729 if(this->OwnFile) 00730 { 00731 for(gdcmFileList::iterator it=InternalFileList.begin(); 00732 it!=InternalFileList.end(); 00733 ++it) 00734 { 00735 (*it)->Delete(); 00736 } 00737 } 00738 this->InternalFileList.clear(); 00739 }
|
|
Definition at line 708 of file vtkGdcmReader.cxx. References InternalFileNameList. Referenced by BuildFileListFromPattern(). 00709 { 00710 this->InternalFileNameList.clear(); 00711 }
|
|
Definition at line 48 of file vtkGdcmReader.h. 00048 { 00049 CoherentFileList = cfl; }
|
|
Definition at line 164 of file vtkGdcmReader.cxx. References FileNameList. Referenced by main(). 00165 { 00166 vtkImageReader2::SetFileName(name); 00167 // Since we maintain a list of filenames, when building a volume, 00168 // (see vtkGdcmReader::AddFileName), we additionaly need to purge 00169 // this list when we manually positionate the filename. 00170 vtkDebugMacro(<< "Clearing all files given with AddFileName"); 00171 this->FileNameList.clear(); 00172 this->Modified(); 00173 }
|
|
Definition at line 60 of file vtkGdcmReader.h. 00061 { UserFunction = userFunc; }
|
|
Test the coherent informations of the file with the reference informations used as image caracteristics. The tested informations are :
Definition at line 646 of file vtkGdcmReader.cxx. References AllowLookupTable, GDCM_NAME_SPACE::Document::GetFileName(), GDCM_NAME_SPACE::File::GetNumberOfScalarComponents(), GDCM_NAME_SPACE::File::GetNumberOfScalarComponentsRaw(), GDCM_NAME_SPACE::File::GetPixelSize(), GDCM_NAME_SPACE::File::GetXSize(), GDCM_NAME_SPACE::File::GetYSize(), GDCM_NAME_SPACE::File::GetZSize(), GDCM_NAME_SPACE::File::HasLUT(), NumColumns, NumComponents, NumLines, NumPlanes, and PixelSize. 00647 { 00648 int numColumns = file->GetXSize(); 00649 int numLines = file->GetYSize(); 00650 int numPlanes = file->GetZSize(); 00651 int numComponents; 00652 unsigned int pixelSize = file->GetPixelSize(); 00653 00654 if( file->HasLUT() && this->AllowLookupTable ) 00655 numComponents = file->GetNumberOfScalarComponentsRaw(); 00656 else 00657 numComponents = file->GetNumberOfScalarComponents(); //rgb or mono 00658 00659 if( numColumns != this->NumColumns ) 00660 { 00661 vtkErrorMacro(<< "File X value doesn't match with the previous ones: " 00662 << file->GetFileName().c_str() 00663 << ". Found " << numColumns << ", must be " 00664 << this->NumColumns); 00665 return false; 00666 } 00667 if( numLines != this->NumLines ) 00668 { 00669 vtkErrorMacro(<< "File Y value doesn't match with the previous ones: " 00670 << file->GetFileName().c_str() 00671 << ". Found " << numLines << ", must be " 00672 << this->NumLines); 00673 return false; 00674 } 00675 if( numPlanes != this->NumPlanes ) 00676 { 00677 vtkErrorMacro(<< "File Z value doesn't match with the previous ones: " 00678 << file->GetFileName().c_str() 00679 << ". Found " << numPlanes << ", must be " 00680 << this->NumPlanes); 00681 return false; 00682 } 00683 if( numComponents != this->NumComponents ) 00684 { 00685 vtkErrorMacro(<< "File Components count doesn't match with the previous ones: " 00686 << file->GetFileName().c_str() 00687 << ". Found " << numComponents << ", must be " 00688 << this->NumComponents); 00689 return false; 00690 } 00691 if( pixelSize != this->PixelSize ) 00692 { 00693 vtkErrorMacro(<< "File pixel size doesn't match with the previous ones: " 00694 << file->GetFileName().c_str() 00695 << ". Found " << pixelSize << ", must be " 00696 << this->PixelSize); 00697 return false; 00698 } 00699 00700 return true; 00701 }
|
|
Update the file informations. This works exactly like LoadFileInformation, but the source of work is the list of coherent files Definition at line 551 of file vtkGdcmReader.cxx. References CoherentFileList, GetFileInformation(), InternalFileList, and OwnFile. Referenced by ExecuteInformation(). 00552 { 00553 this->InternalFileList=*(this->CoherentFileList); 00554 this->OwnFile=false; 00555 00556 for(gdcmFileList::iterator it=InternalFileList.begin(); 00557 it!=InternalFileList.end(); 00558 ++it) 00559 { 00560 if( *it != NULL) 00561 { 00562 GetFileInformation(*it); 00563 break; 00564 } 00565 } 00566 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 139 of file vtkGdcmReader.h. |
|
Definition at line 138 of file vtkGdcmReader.h. Referenced by GetFileInformation(), LoadImageInMemory(), and TestFileInformation(). |
|
Definition at line 159 of file vtkGdcmReader.h. Referenced by GetFileInformation(), and UpdateFileInformation(). |
|
Definition at line 181 of file vtkGdcmReader.h. |
|
Definition at line 158 of file vtkGdcmReader.h. Referenced by AddFileName(), BuildFileListFromPattern(), PrintSelf(), RemoveAllFileName(), and SetFileName(). |
|
Definition at line 136 of file vtkGdcmReader.h. Referenced by ExecuteInformation(). |
|
Definition at line 153 of file vtkGdcmReader.h. Referenced by ExecuteInformation(), and GetFileInformation(). |
|
Definition at line 169 of file vtkGdcmReader.h. Referenced by LoadFileInformation(), RemoveAllInternalFile(), and UpdateFileInformation(). |
|
Definition at line 168 of file vtkGdcmReader.h. Referenced by AddInternalFileName(), BuildFileListFromPattern(), GetFileInformation(), LoadFileInformation(), RemoveAllInternalFileName(), and ~vtkGdcmReader(). |
|
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Bit 2 : Skip Sequences inside a Shadow Group, if possible Probabely (?), some more to add.
Definition at line 179 of file vtkGdcmReader.h. Referenced by LoadFileInformation(). |
|
Definition at line 135 of file vtkGdcmReader.h. Referenced by LoadImageInMemory(), and ~vtkGdcmReader(). |
|
Definition at line 143 of file vtkGdcmReader.h. Referenced by ExecuteInformation(), GetFileInformation(), and TestFileInformation(). |
|
Definition at line 151 of file vtkGdcmReader.h. Referenced by LoadImageInMemory(), and TestFileInformation(). |
|
Definition at line 145 of file vtkGdcmReader.h. Referenced by ExecuteInformation(), GetFileInformation(), IncrementProgress(), and TestFileInformation(). |
|
Definition at line 147 of file vtkGdcmReader.h. Referenced by GetFileInformation(), and TestFileInformation(). |
|
Definition at line 160 of file vtkGdcmReader.h. Referenced by LoadFileInformation(), and UpdateFileInformation(). |
|
Definition at line 155 of file vtkGdcmReader.h. Referenced by GetFileInformation(), and TestFileInformation(). |
|
Definition at line 149 of file vtkGdcmReader.h. Referenced by ExecuteInformation(), and GetFileInformation(). |
|
Pointer to a user suplied function to allow modification of pixel order.
Definition at line 184 of file vtkGdcmReader.h. Referenced by LoadImageInMemory(). |