GDCM  2.2.0
gdcmDirectoryHelper.h
Go to the documentation of this file.
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 /* this class is designed to help mitigate some of the commonly performed operations on directories.
00016 namely:
00017 1) the ability to determine the number of series in a directory by what type of series is present
00018 2) the ability to find all ct series in a directory
00019 3) the ability to find all mr series in a directory
00020 4) to load a set of DataSets from a series that's already been sorted by the IPP sorter
00021 5) For rtstruct stuff, you need to know the sopinstanceuid of each z plane,
00022   so there's a retrieval function for that
00023 6) then a few other functions for rtstruct writeouts
00024 */
00025 
00026 #include "gdcmDirectory.h"
00027 #include "gdcmDataSet.h"
00028 
00029 namespace gdcm
00030 {
00031 class GDCM_EXPORT DirectoryHelper
00032 {
00033 public:
00034   //returns all series UIDs in a given directory that match a particular SOP Instance UID
00035   static Directory::FilenamesType GetSeriesUIDsBySOPClassUID(const std::string& inDirectory,
00036     const std::string& inSOPClassUID);
00037 
00038   //specific implementations of the SOPClassUID grabber, so you don't have to
00039   //remember the SOP Class UIDs of CT or MR images.
00040   static Directory::FilenamesType GetCTImageSeriesUIDs(const std::string& inDirectory);
00041   static Directory::FilenamesType GetMRImageSeriesUIDs(const std::string& inDirectory);
00042   static Directory::FilenamesType GetRTStructSeriesUIDs(const std::string& inDirectory);
00043 
00044   //given a directory and a series UID, provide all filenames with that series UID.
00045   static Directory::FilenamesType GetFilenamesFromSeriesUIDs(const std::string& inDirectory,
00046     const std::string& inSeriesUID);
00047 
00048   //given a series UID, load all the images associated with that series UID
00049   //these images will be IPP sorted, so that they can be used for gathering all
00050   //the necessary information for generating an RTStruct
00051   //this function should be called by the writer once, if the writer's dataset
00052   //vector is empty.  Make sure to have a new writer for new rtstructs.
00053   static std::vector<DataSet> LoadImageFromFiles(const std::string& inDirectory,
00054     const std::string& inSeriesUID);
00055 
00056   //When writing RTStructs, each contour will have z position defined.
00057   //use that z position to determine the SOPInstanceUID for that plane.
00058   static std::string RetrieveSOPInstanceUIDFromZPosition(double inZPos,
00059     const std::vector<DataSet>& inDS);
00060 
00061   //When writing RTStructs, the frame of reference is done by planes to start with
00062   static std::string RetrieveSOPInstanceUIDFromIndex(int inIndex,
00063    const std::vector<DataSet>& inDS);
00064 
00065   //each plane needs to know the SOPClassUID, and that won't change from image to image
00066   //so, retrieve this once at the start of writing.
00067   static std::string GetSOPClassUID(const std::vector<DataSet>& inDS);
00068 
00069   //retrieve the frame of reference from the set of datasets
00070   static std::string GetFrameOfReference(const std::vector<DataSet>& inDS);
00071 };
00072 
00073 }

Generated on Fri May 25 2012 13:12:39 for GDCM by doxygen 1.8.0
SourceForge.net Logo