#include <gdcmSerieHelper.h>
Inheritance diagram for gdcm::SerieHelper:
Public Types | |
typedef std::map< std::string, FileList * > | SingleSerieUIDFileSetmap |
typedef std::vector< File * > | FileVector |
Public Member Functions | |
virtual | ~SerieHelper () |
Canonical destructor. | |
void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Canonical printer. | |
void | AddFileName (std::string const &filename) |
add a gdcm::File to the Fileset corresponding to its Serie UID | |
void | AddGdcmFile (File *header) |
add a gdcm::File to the first (and supposed to be unique) file set of the gdcm::SerieHelper. | |
void | SetDirectory (std::string const &dir, bool recursive=false) |
Sets the root Directory. | |
bool | IsCoherent (FileList *fileSet) |
Elementary coherence checking of the files with the same Serie UID Only sizes and pixel type are checked right now ... | |
void | OrderFileList (FileList *fileSet) |
Sorts the given Fileset. | |
const FileList & | GetFileList () |
Gets the FIRST Single SerieUID Fileset. Deprecated; kept not to break the API. | |
GDCM_LEGACY (FileList *GetFirstCoherentFileList()) | |
GDCM_LEGACY (FileList *GetNextCoherentFileList()) | |
GDCM_LEGACY (FileList *GetCoherentFileList(std::string serieUID)) | |
FileList * | GetFirstSingleSerieUIDFileSet () |
Get the first Fileset while visiting the SingleSerieUIDFileSetmap. | |
FileList * | GetNextSingleSerieUIDFileSet () |
Get the next Fileset while visiting the SingleSerieUIDFileSetmap. | |
FileList * | GetSingleSerieUIDFileSet (std::string serieUID) |
Get the SingleSerieUIDFileSet according to its Serie UID. | |
std::string | GetCurrentSerieUIDFileSetUID () |
brief returns the 'Series Instance UID' Single SerieUID FileSet | |
GDCM_LEGACY (void AddRestriction(TagKey const &key, std::string const &value)) | |
void | AddRestriction (TagKey const &key, std::string const &value, int op) |
add a rules for restricting a DICOM file to be in the serie we are trying to find. For example you can select only the DICOM file from a directory which would have a particular EchoTime==4.0. This method is a user level, value is not required to be formatted as a DICOM string | |
void | SetLoadMode (int mode) |
Sets the LoadMode as a boolean string. LD_NOSEQ, LD_NOSHADOW, LD_NOSHADOWSEQ ... (nothing more, right now) WARNING : before using LD_NOSHADOW, be sure *all* your files contain accurate values in the 0x0000 element (if any) of *each* Shadow Group. The parser will fail if the size is wrong ! | |
void | SetSortOrderToDirect () |
Brief User wants the files to be sorted Direct Order (default value). | |
void | SetSortOrderToReverse () |
Brief User wants the files to be sorted Reverse Order. | |
void | SetUserLessThanFunction (BOOL_FUNCTION_PFILE_PFILE_POINTER userFunc) |
to allow user to give is own comparison function | |
XCoherentFileSetmap | SplitOnOrientation (FileList *fileSet) |
Splits a Single SerieUID Fileset according to the Orientations. | |
XCoherentFileSetmap | SplitOnPosition (FileList *fileSet) |
Splits a 'Single SerieUID' Fileset according to the Positions. | |
XCoherentFileSetmap | SplitOnTagValue (FileList *fileSet, uint16_t group, uint16_t elem) |
Splits a 'Single SerieUID' File set Coherent according to the value of a given Tag. | |
void | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static SerieHelper * | New () |
Protected Member Functions | |
SerieHelper () | |
Constructor from a given SerieHelper. | |
Protected Attributes | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Types | |
typedef std::pair< TagKey, std::string > | Rule |
typedef std::vector< Rule > | SerieRestrictions |
typedef std::vector< ExRule > | SerieExRestrictions |
Private Member Functions | |
gdcmTypeMacro (SerieHelper) | |
void | ClearAll () |
Preventively, clear everything at constructor time. ( use it at destructor time.). | |
bool | UserOrdering (FileList *fileSet) |
sorts the images, according to user supplied function | |
bool | ImagePositionPatientOrdering (FileList *fileSet) |
sorts the images, according to their Patient Position We may order, considering :
| |
bool | ImageNumberOrdering (FileList *fileSet) |
sorts the images, according to their Image Number | |
bool | FileNameOrdering (FileList *fileSet) |
sorts the images, according to their File Name | |
Static Private Member Functions | |
static bool | ImageNumberLessThan (File *file1, File *file2) |
static bool | ImageNumberGreaterThan (File *file1, File *file2) |
static bool | FileNameLessThan (File *file1, File *file2) |
static bool | FileNameGreaterThan (File *file1, File *file2) |
Private Attributes | |
SingleSerieUIDFileSetmap | SingleSerieUIDFileSetHT |
SingleSerieUIDFileSetmap::iterator | ItFileSetHt |
SerieRestrictions | Restrictions |
SerieExRestrictions | ExRestrictions |
int | LoadMode |
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Probabely, some more to add. | |
bool | DirectOrder |
whether we want to sort in direct order or not (reverse order). To be used by aware user only | |
BOOL_FUNCTION_PFILE_PFILE_POINTER | UserLessThanFunction |
If user knows more about his images than gdcm does, he may supply his own comparison function. | |
Classes | |
struct | ExRule |
Definition at line 59 of file gdcmSerieHelper.h.
|
Definition at line 69 of file gdcmSerieHelper.h. |
|
Definition at line 151 of file gdcmSerieHelper.h. |
|
Definition at line 162 of file gdcmSerieHelper.h. |
|
Definition at line 152 of file gdcmSerieHelper.h. |
|
SingleSerieUIDFileSetmap replaces the former CoherentFileListmap ( List were actually std::vectors, and wher no coherent at all : They were only Single SeriesInstanceUID File sets) Definition at line 67 of file gdcmSerieHelper.h. |
|
Canonical destructor.
Definition at line 51 of file gdcmSerieHelper.cxx. References ClearAll(). 00052 { 00053 ClearAll(); 00054 }
|
|
Constructor from a given SerieHelper.
Definition at line 41 of file gdcmSerieHelper.cxx. References ClearAll(), DirectOrder, and UserLessThanFunction. 00042 { 00043 ClearAll(); 00044 UserLessThanFunction = 0; 00045 DirectOrder = true; 00046 }
|
|
add a gdcm::File to the Fileset corresponding to its Serie UID
Definition at line 88 of file gdcmSerieHelper.cxx. References gdcm::Util::CompareDicomString(), gdcm::RefCounter::Delete(), gdcm::SerieHelper::ExRule::elem, ExRestrictions, gdcmDebugMacro, gdcmWarningMacro, gdcm::DocEntrySet::GetEntryString(), gdcm::SerieHelper::ExRule::group, gdcm::File::IsReadable(), gdcm::File::Load(), LoadMode, gdcm::File::New(), gdcm::SerieHelper::ExRule::op, gdcm::Document::SetFileName(), gdcm::Document::SetLoadMode(), SingleSerieUIDFileSetHT, and gdcm::SerieHelper::ExRule::value. Referenced by SetDirectory(). 00089 { 00090 // Create a DICOM file 00091 File *header = File::New(); 00092 header->SetLoadMode(LoadMode); 00093 header->SetFileName( filename ); 00094 header->Load(); 00095 00096 if ( header->IsReadable() ) 00097 { 00098 int allrules = 1; 00099 // First step : the user defined a set of rules for the DICOM file 00100 // he is looking for. 00101 // Make sure the file corresponds to his set of rules: 00102 00103 std::string s; 00104 for(SerieExRestrictions::iterator it2 = ExRestrictions.begin(); 00105 it2 != ExRestrictions.end(); 00106 ++it2) 00107 { 00108 const ExRule &r = *it2; 00109 s = header->GetEntryString( r.group, r.elem ); 00110 if ( !Util::CompareDicomString(s, r.value.c_str(), r.op) ) 00111 { 00112 // Argh ! This rule is unmatched; let's just quit 00113 00114 allrules = 0; 00115 break; 00116 } 00117 } 00118 00119 if ( allrules ) // all rules are respected: 00120 { 00121 // Allright! we have a found a DICOM that matches the user expectation. 00122 // Let's add it! 00123 00124 // 0020 000e UI REL Series Instance UID 00125 const std::string &uid = header->GetEntryString(0x0020, 0x000e); 00126 // if uid == GDCM_UNFOUND then consistently we should find GDCM_UNFOUND 00127 // no need here to do anything special 00128 00129 00130 if ( SingleSerieUIDFileSetHT.count(uid) == 0 ) 00131 { 00132 gdcmDebugMacro(" New Serie UID :[" << uid << "]"); 00133 // create a std::list in 'uid' position 00134 SingleSerieUIDFileSetHT[uid] = new FileList; 00135 } 00136 // Current Serie UID and DICOM header seems to match; add the file: 00137 SingleSerieUIDFileSetHT[uid]->push_back( header ); 00138 } 00139 else 00140 { 00141 // at least one rule was unmatched we need to deallocate the file: 00142 header->Delete(); 00143 } 00144 } 00145 else 00146 { 00147 gdcmWarningMacro("Could not read file: " << filename ); 00148 header->Delete(); 00149 } 00150 }
|
|
add a gdcm::File to the first (and supposed to be unique) file set of the gdcm::SerieHelper.
Definition at line 170 of file gdcmSerieHelper.cxx. References gdcm::Util::DicomStringEqual(), gdcmDebugMacro, Restrictions, and SingleSerieUIDFileSetHT. 00171 { 00172 int allrules = 1; 00173 // First step the user has defined a set of rules for the DICOM 00174 // he is looking for. 00175 // make sure the file correspond to his set of rules: 00176 for(SerieRestrictions::iterator it = Restrictions.begin(); 00177 it != Restrictions.end(); 00178 ++it) 00179 { 00180 const Rule &r = *it; 00181 const std::string s;// = header->GetEntryValue( r.first ); 00182 if ( !Util::DicomStringEqual(s, r.second.c_str()) ) 00183 { 00184 // Argh ! This rule is unmatch let's just quit 00185 allrules = 0; 00186 break; 00187 } 00188 } 00189 if ( allrules ) // all rules are respected: 00190 { 00191 // Allright ! we have a found a DICOM that match the user expectation. 00192 // Let's add it ! 00193 00194 const std::string &uid = "0"; 00195 // Serie UID of the gdcm::File* may be different. 00196 // User is supposed to know what he wants 00197 00198 if ( SingleSerieUIDFileSetHT.count(uid) == 0 ) 00199 { 00200 gdcmDebugMacro(" New Serie UID :[" << uid << "]"); 00201 // create a std::list in 'uid' position 00202 SingleSerieUIDFileSetHT[uid] = new FileList; 00203 } 00204 // Current Serie UID and DICOM header seems to match; add the file: 00205 SingleSerieUIDFileSetHT[uid]->push_back( header ); 00206 } 00207 // Even if a rule was unmatch we don't deallocate the gdcm::File: 00208 }
|
|
add a rules for restricting a DICOM file to be in the serie we are trying to find. For example you can select only the DICOM file from a directory which would have a particular EchoTime==4.0. This method is a user level, value is not required to be formatted as a DICOM string
Definition at line 221 of file gdcmSerieHelper.cxx. References gdcm::SerieHelper::ExRule::elem, ExRestrictions, gdcm::SerieHelper::ExRule::group, gdcm::SerieHelper::ExRule::op, and gdcm::SerieHelper::ExRule::value. 00223 { 00224 ExRule r; 00225 r.group = key[0]; 00226 r.elem = key[1]; 00227 r.value = value; 00228 r.op = op; 00229 ExRestrictions.push_back( r ); 00230 }
|
|
Preventively, clear everything at constructor time. ( use it at destructor time.).
Definition at line 60 of file gdcmSerieHelper.cxx. References GetFirstSingleSerieUIDFileSet(), and GetNextSingleSerieUIDFileSet(). Referenced by SerieHelper(), and ~SerieHelper(). 00061 { 00062 // For all the 'Single SerieUID' Filesets that may already exist 00063 FileList *l = GetFirstSingleSerieUIDFileSet(); 00064 while (l) 00065 { 00066 // For all the gdcm::File of a File set 00067 for (gdcm::FileList::iterator it = l->begin(); 00068 it != l->end(); 00069 ++it) 00070 { 00071 (*it)->Delete(); // remove each entry 00072 } 00073 l->clear(); 00074 delete l; // remove the container 00075 l = GetNextSingleSerieUIDFileSet(); 00076 } 00077 }
|
|
|
Definition at line 766 of file gdcmSerieHelper.cxx. References gdcm::Document::GetFileName(). Referenced by FileNameOrdering().
|
|
Definition at line 761 of file gdcmSerieHelper.cxx. References gdcm::Document::GetFileName(). Referenced by FileNameOrdering().
|
|
sorts the images, according to their File Name
Definition at line 775 of file gdcmSerieHelper.cxx. References DirectOrder, FileNameGreaterThan(), and FileNameLessThan(). Referenced by OrderFileList(). 00776 { 00777 if (DirectOrder) 00778 std::sort(fileList->begin(), fileList->end(), 00779 SerieHelper::FileNameLessThan); 00780 else 00781 std::sort(fileList->begin(), fileList->end(), 00782 SerieHelper::FileNameGreaterThan); 00783 00784 return true; 00785 }
|
|
All the following allow user to restrict DICOM file to be part of a particular serie |
|
|
|
|
|
|
|
|
|
brief returns the 'Series Instance UID' Single SerieUID FileSet
Definition at line 99 of file gdcmSerieHelper.h.
|
|
Gets the FIRST Single SerieUID Fileset. Deprecated; kept not to break the API.
Definition at line 88 of file gdcmSerieHelper.h. 00089 { return *SingleSerieUIDFileSetHT.begin()->second; }
|
|
Get the first Fileset while visiting the SingleSerieUIDFileSetmap.
Definition at line 356 of file gdcmSerieHelper.cxx. References ItFileSetHt, and SingleSerieUIDFileSetHT. Referenced by ClearAll(). 00357 { 00358 ItFileSetHt = SingleSerieUIDFileSetHT.begin(); 00359 if ( ItFileSetHt != SingleSerieUIDFileSetHT.end() ) 00360 return ItFileSetHt->second; 00361 return NULL; 00362 }
|
|
Get the next Fileset while visiting the SingleSerieUIDFileSetmap.
Definition at line 369 of file gdcmSerieHelper.cxx. References gdcmAssertMacro, ItFileSetHt, and SingleSerieUIDFileSetHT. Referenced by ClearAll(). 00370 { 00371 gdcmAssertMacro (ItFileSetHt != SingleSerieUIDFileSetHT.end()); 00372 00373 ++ItFileSetHt; 00374 if ( ItFileSetHt != SingleSerieUIDFileSetHT.end() ) 00375 return ItFileSetHt->second; 00376 return NULL; 00377 }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Get the reference counting.
Definition at line 57 of file gdcmRefCounter.h. 00058 { 00059 return RefCount; 00060 }
|
|
Get the SingleSerieUIDFileSet according to its Serie UID.
Definition at line 384 of file gdcmSerieHelper.cxx. References SingleSerieUIDFileSetHT. 00385 { 00386 if ( SingleSerieUIDFileSetHT.count(SerieUID) == 0 ) 00387 return 0; 00388 return SingleSerieUIDFileSetHT[SerieUID]; 00389 }
|
|
Definition at line 716 of file gdcmSerieHelper.cxx. References gdcm::File::GetImageNumber(). Referenced by ImageNumberOrdering().
|
|
Definition at line 711 of file gdcmSerieHelper.cxx. References gdcm::File::GetImageNumber(). Referenced by ImageNumberOrdering().
|
|
sorts the images, according to their Image Number
Definition at line 729 of file gdcmSerieHelper.cxx. References DirectOrder, gdcmWarningMacro, ImageNumberGreaterThan(), and ImageNumberLessThan(). Referenced by OrderFileList(). 00730 { 00731 int min, max, pos; 00732 int n = fileList->size(); 00733 00734 FileList::const_iterator it = fileList->begin(); 00735 min = max = (*it)->GetImageNumber(); 00736 00737 for (; it != fileList->end(); ++it, ++n) 00738 { 00739 pos = (*it)->GetImageNumber(); 00740 min = (min < pos) ? min : pos; 00741 max = (max > pos) ? max : pos; 00742 } 00743 00744 // Find out if image numbers are coherent (consecutive) 00745 if ( min == max || max == 0 || max >= (n+min) ) 00746 { 00747 gdcmWarningMacro( " 'Image numbers' not coherent. " 00748 << " No ImageNumberOrdering sort performed."); 00749 return false; 00750 } 00751 if (DirectOrder) 00752 std::sort(fileList->begin(), fileList->end(), 00753 SerieHelper::ImageNumberLessThan ); 00754 else 00755 std::sort(fileList->begin(), fileList->end(), 00756 SerieHelper::ImageNumberGreaterThan ); 00757 00758 return true; 00759 }
|
|
sorts the images, according to their Patient Position We may order, considering :
Definition at line 576 of file gdcmSerieHelper.cxx. References DirectOrder, and gdcmWarningMacro. Referenced by OrderFileList(). 00578 { 00579 //iop is calculated based on the file file 00580 float cosines[6]; 00581 float normal[3]; 00582 float ipp[3]; 00583 float dist; 00584 float min = 0, max = 0; 00585 bool first = true; 00586 int n=0; 00587 std::vector<float> distlist; 00588 00590 for ( FileList::const_iterator 00591 it = fileList->begin(); 00592 it != fileList->end(); ++it ) 00593 { 00594 if ( first ) 00595 { 00596 (*it)->GetImageOrientationPatient( cosines ); 00597 00598 // You only have to do this once for all slices in the volume. Next, 00599 // for each slice, calculate the distance along the slice normal 00600 // using the IPP ("Image Position Patient") tag. 00601 // ("dist" is initialized to zero before reading the first slice) : 00602 normal[0] = cosines[1]*cosines[5] - cosines[2]*cosines[4]; 00603 normal[1] = cosines[2]*cosines[3] - cosines[0]*cosines[5]; 00604 normal[2] = cosines[0]*cosines[4] - cosines[1]*cosines[3]; 00605 00606 ipp[0] = (*it)->GetXOrigin(); 00607 ipp[1] = (*it)->GetYOrigin(); 00608 ipp[2] = (*it)->GetZOrigin(); 00609 00610 dist = 0; 00611 for ( int i = 0; i < 3; ++i ) 00612 { 00613 dist += normal[i]*ipp[i]; 00614 } 00615 00616 distlist.push_back( dist ); 00617 00618 max = min = dist; 00619 first = false; 00620 } 00621 else 00622 { 00623 ipp[0] = (*it)->GetXOrigin(); 00624 ipp[1] = (*it)->GetYOrigin(); 00625 ipp[2] = (*it)->GetZOrigin(); 00626 00627 dist = 0; 00628 for ( int i = 0; i < 3; ++i ) 00629 { 00630 dist += normal[i]*ipp[i]; 00631 } 00632 00633 distlist.push_back( dist ); 00634 00635 min = (min < dist) ? min : dist; 00636 max = (max > dist) ? max : dist; 00637 } 00638 ++n; 00639 } 00640 00641 // Then I order the slices according to the value "dist". Finally, once 00642 // I've read in all the slices, I calculate the z-spacing as the difference 00643 // between the "dist" values for the first two slices. 00644 FileVector CoherentFileVector(n); 00645 // CoherentFileVector.reserve( n ); 00646 CoherentFileVector.resize( n ); 00647 // gdcmAssertMacro( CoherentFileVector.capacity() >= n ); 00648 00649 // Find out if min/max are coherent 00650 if ( min == max ) 00651 { 00652 gdcmWarningMacro("Looks like all images have the exact same image position" 00653 << ". No PositionPatientOrdering sort performed" ); 00654 return false; 00655 } 00656 00657 float step = (max - min)/(n - 1); 00658 int pos; 00659 n = 0; 00660 00661 //VC++ don't understand what scope is !! it -> it2 00662 for (FileList::const_iterator it2 = fileList->begin(); 00663 it2 != fileList->end(); ++it2, ++n) 00664 { 00665 //2*n sort algo !! 00666 //Assumption: all files are present (no one missing) 00667 pos = (int)( fabs( (distlist[n]-min)/step) + .5 ); 00668 00669 // a Dicom 'Serie' may contain scout views 00670 // and images may have differents directions 00671 // -> More than one may have the same 'pos' 00672 // Sorting has then NO meaning ! 00673 if (CoherentFileVector[pos]==NULL) 00674 CoherentFileVector[pos] = *it2; 00675 else 00676 { 00677 gdcmWarningMacro( "At least 2 files with same position." 00678 << " No PositionPatientOrdering sort performed"); 00679 return false; 00680 } 00681 } 00682 00683 fileList->clear(); // doesn't delete list elements, only nodes 00684 00685 if (DirectOrder) 00686 { 00687 //VC++ don't understand what scope is !! it -> it3 00688 for (FileVector::const_iterator it3 = CoherentFileVector.begin(); 00689 it3 != CoherentFileVector.end(); ++it3) 00690 { 00691 fileList->push_back( *it3 ); 00692 } 00693 } 00694 else // user asked for reverse order 00695 { 00696 FileVector::const_iterator it4; 00697 it4 = CoherentFileVector.end(); 00698 do 00699 { 00700 it4--; 00701 fileList->push_back( *it4 ); 00702 } while (it4 != CoherentFileVector.begin() ); 00703 } 00704 00705 distlist.clear(); 00706 CoherentFileVector.clear(); 00707 00708 return true; 00709 }
|
|
Elementary coherence checking of the files with the same Serie UID Only sizes and pixel type are checked right now ...
Definition at line 292 of file gdcmSerieHelper.cxx. 00293 { 00294 if(fileSet->size() == 1) 00295 return true; 00296 00297 FileList::const_iterator it = fileSet->begin(); 00298 00299 int nX = (*it)->GetXSize(); 00300 int nY = (*it)->GetYSize(); 00301 int pixelSize = (*it)->GetPixelSize(); 00302 bool signedPixelData = (*it)->IsSignedPixelData(); 00303 it ++; 00304 for ( ; 00305 it != fileSet->end(); 00306 ++it) 00307 { 00308 if ( (*it)->GetXSize() != nX ) 00309 return false; 00310 if ( (*it)->GetYSize() != nY ) 00311 return false; 00312 if ( (*it)->GetPixelSize() != pixelSize ) 00313 return false; 00314 if ( (*it)->IsSignedPixelData() != signedPixelData ) 00315 return false; 00316 // probabely more is to be checked (?) 00317 } 00318 return true; 00319 }
|
|
Definition at line 71 of file gdcmSerieHelper.h. 00071 {return new SerieHelper();}
|
|
Sorts the given Fileset.
Definition at line 266 of file gdcmSerieHelper.cxx. References FileNameOrdering(), ImageNumberOrdering(), ImagePositionPatientOrdering(), UserLessThanFunction, and UserOrdering(). 00267 { 00268 00269 if ( SerieHelper::UserLessThanFunction ) 00270 { 00271 UserOrdering( fileSet ); 00272 return; 00273 } 00274 else if ( ImagePositionPatientOrdering( fileSet ) ) 00275 { 00276 return ; 00277 } 00278 else if ( ImageNumberOrdering(fileSet ) ) 00279 { 00280 return ; 00281 } 00282 else 00283 { 00284 FileNameOrdering(fileSet ); 00285 } 00286 }
|
|
Canonical printer.
Reimplemented from gdcm::Base. Definition at line 808 of file gdcmSerieHelper.cxx. References gdcmWarningMacro, and SingleSerieUIDFileSetHT. 00809 { 00810 // For all the Coherent File lists of the gdcm::Serie 00811 SingleSerieUIDFileSetmap::iterator itl = SingleSerieUIDFileSetHT.begin(); 00812 if ( itl == SingleSerieUIDFileSetHT.end() ) 00813 { 00814 gdcmWarningMacro( "No SingleSerieUID File set found" ); 00815 return; 00816 } 00817 while (itl != SingleSerieUIDFileSetHT.end()) 00818 { 00819 os << "Serie UID :[" << itl->first << "]" << std::endl; 00820 00821 // For all the files of a SingleSerieUID File set 00822 for (FileList::iterator it = (itl->second)->begin(); 00823 it != (itl->second)->end(); 00824 ++it) 00825 { 00826 os << indent << " --- " << (*it)->GetFileName() << std::endl; 00827 } 00828 ++itl; 00829 } 00830 }
|
|
Register the object.
Definition at line 45 of file gdcmRefCounter.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem(). 00045 { RefCount++; }
|
|
Sets the root Directory.
Definition at line 247 of file gdcmSerieHelper.cxx. References AddFileName(), and gdcm::DirList::GetFilenames(). 00248 { 00249 DirList dirList(dir, recursive); // OS specific 00250 00251 DirListType filenames_list = dirList.GetFilenames(); 00252 for( DirListType::const_iterator it = filenames_list.begin(); 00253 it != filenames_list.end(); ++it) 00254 { 00255 AddFileName( *it ); 00256 } 00257 }
|
|
Sets the LoadMode as a boolean string. LD_NOSEQ, LD_NOSHADOW, LD_NOSHADOWSEQ ... (nothing more, right now) WARNING : before using LD_NOSHADOW, be sure *all* your files contain accurate values in the 0x0000 element (if any) of *each* Shadow Group. The parser will fail if the size is wrong !
Definition at line 115 of file gdcmSerieHelper.h. 00115 { LoadMode = mode; }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Brief User wants the files to be sorted Direct Order (default value).
Definition at line 118 of file gdcmSerieHelper.h. 00118 { DirectOrder = true; }
|
|
Brief User wants the files to be sorted Reverse Order.
Definition at line 121 of file gdcmSerieHelper.h. 00121 { DirectOrder = false; }
|
|
to allow user to give is own comparison function
Definition at line 124 of file gdcmSerieHelper.h. 00125 { UserLessThanFunction = userFunc; }
|
|
Splits a Single SerieUID Fileset according to the Orientations.
Definition at line 397 of file gdcmSerieHelper.cxx. References gdcmDebugMacro. 00398 { 00399 XCoherentFileSetmap CoherentFileSet; 00400 00401 int nb = fileSet->size(); 00402 if (nb == 0 ) 00403 return CoherentFileSet; 00404 float iop[6]; 00405 00406 std::string strOrient; 00407 std::ostringstream ossOrient; 00408 FileList::const_iterator it = fileSet->begin(); 00409 it ++; 00410 for ( ; 00411 it != fileSet->end(); 00412 ++it) 00413 { 00414 // Information is in : 00415 // 0020 0037 : Image Orientation (Patient) or 00416 // 0020 0035 : Image Orientation (RET) 00417 00418 // Let's build again the 'cosines' string, to be sure of it's format 00419 (*it)->GetImageOrientationPatient(iop); 00420 00421 ossOrient << iop[0]; 00422 for (int i = 1; i < 6; i++) 00423 { 00424 ossOrient << "\\"; 00425 ossOrient << iop[i]; 00426 } 00427 strOrient = ossOrient.str(); 00428 ossOrient.str(""); 00429 // FIXME : is it a 'cleaner' way to initialize an ostringstream? 00430 00431 if ( CoherentFileSet.count(strOrient) == 0 ) 00432 { 00433 gdcmDebugMacro(" New Orientation :[" << strOrient << "]"); 00434 // create a File set in 'orientation' position 00435 CoherentFileSet[strOrient] = new FileList; 00436 } 00437 // Current Orientation and DICOM header match; add the file: 00438 CoherentFileSet[strOrient]->push_back( (*it) ); 00439 } 00440 return CoherentFileSet; 00441 }
|
|
Splits a 'Single SerieUID' Fileset according to the Positions.
Definition at line 449 of file gdcmSerieHelper.cxx. References gdcm::GDCM_UNFOUND, gdcmDebugMacro, and gdcmWarningMacro. 00450 { 00451 XCoherentFileSetmap CoherentFileSet; 00452 00453 int nb = fileSet->size(); 00454 if (nb == 0 ) 00455 return CoherentFileSet; 00456 float pos[3]; 00457 std::string strImPos; // read on disc 00458 std::ostringstream ossPosition; 00459 std::string strPosition; // re computed 00460 FileList::const_iterator it = fileSet->begin(); 00461 it ++; 00462 for ( ; 00463 it != fileSet->end(); 00464 ++it) 00465 { 00466 // Information is in : 00467 // 0020,0032 : Image Position Patient 00468 // 0020,0030 : Image Position (RET) 00469 00470 strImPos = (*it)->GetEntryString(0x0020,0x0032); 00471 if ( strImPos == GDCM_UNFOUND) 00472 { 00473 gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)"); 00474 strImPos = (*it)->GetEntryString(0x0020,0x0030); // For ACR-NEMA images 00475 if ( strImPos == GDCM_UNFOUND ) 00476 { 00477 gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)"); 00478 // User wants to split on the 'Position' 00479 // No 'Position' info found. 00480 // We return an empty Htable ! 00481 return CoherentFileSet; 00482 } 00483 } 00484 00485 if ( sscanf( strImPos.c_str(), "%f \\%f \\%f ", 00486 &pos[0], &pos[1], &pos[2]) != 3 ) 00487 { 00488 gdcmWarningMacro( "Wrong number for Position : [" 00489 << strImPos << "]" ); 00490 return CoherentFileSet; 00491 } 00492 00493 // Let's build again the 'position' string, to be sure of it's format 00494 00495 ossPosition << pos[0]; 00496 for (int i = 1; i < 3; i++) 00497 { 00498 ossPosition << "\\"; 00499 ossPosition << pos[i]; 00500 } 00501 strPosition = ossPosition.str(); 00502 ossPosition.str(""); 00503 00504 if ( CoherentFileSet.count(strPosition) == 0 ) 00505 { 00506 gdcmDebugMacro(" New Position :[" << strPosition << "]"); 00507 // create a File set in 'position' position 00508 CoherentFileSet[strPosition] = new FileList; 00509 } 00510 // Current Position and DICOM header match; add the file: 00511 CoherentFileSet[strPosition]->push_back( (*it) ); 00512 } 00513 return CoherentFileSet; 00514 }
|
|
Splits a 'Single SerieUID' File set Coherent according to the value of a given Tag.
Definition at line 525 of file gdcmSerieHelper.cxx. References gdcmDebugMacro. 00527 { 00528 XCoherentFileSetmap CoherentFileSet; 00529 00530 int nb = fileSet->size(); 00531 if (nb == 0 ) 00532 return CoherentFileSet; 00533 00534 std::string strTagValue; // read on disc 00535 00536 FileList::const_iterator it = fileSet->begin(); 00537 it ++; 00538 for ( ; 00539 it != fileSet->end(); 00540 ++it) 00541 { 00542 // Information is in : 00543 // 0020,0032 : Image Position Patient 00544 // 0020,0030 : Image Position (RET) 00545 00546 strTagValue = (*it)->GetEntryString(group,elem); 00547 00548 if ( CoherentFileSet.count(strTagValue) == 0 ) 00549 { 00550 gdcmDebugMacro(" New Tag Value :[" << strTagValue << "]"); 00551 // create a File set in 'position' position 00552 CoherentFileSet[strTagValue] = new FileList; 00553 } 00554 // Current Tag value and DICOM header match; add the file: 00555 CoherentFileSet[strTagValue]->push_back( (*it) ); 00556 } 00557 return CoherentFileSet; 00558 }
|
|
Unregister the object.
Definition at line 49 of file gdcmRefCounter.h. Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DocEntrySet::GetDictEntry(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().
|
|
sorts the images, according to user supplied function
Definition at line 792 of file gdcmSerieHelper.cxx. References DirectOrder, and UserLessThanFunction. Referenced by OrderFileList(). 00793 { 00794 std::sort(fileList->begin(), fileList->end(), 00795 SerieHelper::UserLessThanFunction); 00796 if (!DirectOrder) 00797 { 00798 std::reverse(fileList->begin(), fileList->end()); 00799 } 00800 return true; 00801 }
|
|
whether we want to sort in direct order or not (reverse order). To be used by aware user only
Definition at line 173 of file gdcmSerieHelper.h. Referenced by FileNameOrdering(), ImageNumberOrdering(), ImagePositionPatientOrdering(), SerieHelper(), and UserOrdering(). |
|
Definition at line 163 of file gdcmSerieHelper.h. Referenced by AddFileName(), and AddRestriction(). |
|
Definition at line 149 of file gdcmSerieHelper.h. Referenced by GetFirstSingleSerieUIDFileSet(), and GetNextSingleSerieUIDFileSet(). |
|
Bit string integer (each one considered as a boolean) Bit 0 : Skip Sequences, if possible Bit 1 : Skip Shadow Groups if possible Probabely, some more to add.
Definition at line 169 of file gdcmSerieHelper.h. Referenced by AddFileName(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and gdcm::DataEntry::Print(). |
|
Definition at line 153 of file gdcmSerieHelper.h. Referenced by AddGdcmFile(). |
|
Definition at line 148 of file gdcmSerieHelper.h. Referenced by AddFileName(), AddGdcmFile(), GetFirstSingleSerieUIDFileSet(), GetNextSingleSerieUIDFileSet(), GetSingleSerieUIDFileSet(), and Print(). |
|
If user knows more about his images than gdcm does, he may supply his own comparison function.
Definition at line 177 of file gdcmSerieHelper.h. Referenced by OrderFileList(), SerieHelper(), and UserOrdering(). |