GDCM
2.2.3
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 00015 #include "gdcmDirectory.h" 00016 #include "gdcmDataSet.h" 00017 00018 namespace gdcm 00019 { 00020 00035 class GDCM_EXPORT DirectoryHelper 00036 { 00037 public: 00038 //returns all series UIDs in a given directory that match a particular SOP Instance UID 00039 static Directory::FilenamesType GetSeriesUIDsBySOPClassUID(const std::string& inDirectory, 00040 const std::string& inSOPClassUID); 00041 00042 //specific implementations of the SOPClassUID grabber, so you don't have to 00043 //remember the SOP Class UIDs of CT or MR images. 00044 static Directory::FilenamesType GetCTImageSeriesUIDs(const std::string& inDirectory); 00045 static Directory::FilenamesType GetMRImageSeriesUIDs(const std::string& inDirectory); 00046 static Directory::FilenamesType GetRTStructSeriesUIDs(const std::string& inDirectory); 00047 00048 //given a directory and a series UID, provide all filenames with that series UID. 00049 static Directory::FilenamesType GetFilenamesFromSeriesUIDs(const std::string& inDirectory, 00050 const std::string& inSeriesUID); 00051 00052 //given a series UID, load all the images associated with that series UID 00053 //these images will be IPP sorted, so that they can be used for gathering all 00054 //the necessary information for generating an RTStruct 00055 //this function should be called by the writer once, if the writer's dataset 00056 //vector is empty. Make sure to have a new writer for new rtstructs. 00057 static std::vector<DataSet> LoadImageFromFiles(const std::string& inDirectory, 00058 const std::string& inSeriesUID); 00059 00060 //When writing RTStructs, each contour will have z position defined. 00061 //use that z position to determine the SOPInstanceUID for that plane. 00062 static std::string RetrieveSOPInstanceUIDFromZPosition(double inZPos, 00063 const std::vector<DataSet>& inDS); 00064 00065 //When writing RTStructs, the frame of reference is done by planes to start with 00066 static std::string RetrieveSOPInstanceUIDFromIndex(int inIndex, 00067 const std::vector<DataSet>& inDS); 00068 00069 //each plane needs to know the SOPClassUID, and that won't change from image to image 00070 //so, retrieve this once at the start of writing. 00071 static std::string GetSOPClassUID(const std::vector<DataSet>& inDS); 00072 00073 //retrieve the frame of reference from the set of datasets 00074 static std::string GetFrameOfReference(const std::vector<DataSet>& inDS); 00075 00076 //both the image and polydata readers use these functions to get std::strings 00077 static std::string GetStringValueFromTag(const gdcm::Tag& t, const gdcm::DataSet& ds); 00078 }; 00079 00080 }