Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:42

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 #ifndef DicomFileMgr__HH
0027 #define DicomFileMgr__HH
0028 #include "dcmtk/dcmdata/dcfilefo.h"
0029 
0030 #include "globals.hh"
0031 
0032 #include <map>
0033 #include <vector>
0034 class DicomVFile;
0035 class DicomFileCT;
0036 class DicomFileStructure;
0037 class DicomFilePlan;
0038 class DicomFilePET;
0039 class DcmDataset;
0040 
0041 // typedef std::multimap<OFString,DicomVFile*> msd;
0042 typedef std::map<G4double, DicomFileCT*> mdct;
0043 typedef std::map<G4double, DicomFilePET*> mdpet;
0044 enum VerbLevel
0045 {
0046   silentVerb = -1,
0047   errorVerb = 0,
0048   warningVerb = 1,
0049   infoVerb = 2,
0050   debugVerb = 3,
0051   testVerb = 4
0052 };
0053 
0054 class DicomFileMgr
0055 {
0056   public:
0057     static DicomFileMgr* GetInstance();
0058     ~DicomFileMgr() {};
0059 
0060   private:
0061     DicomFileMgr();
0062 
0063   public:
0064     std::vector<DicomFileStructure*> GetStructFiles() const { return theStructFiles; }
0065 
0066     void SetCompression(G4String fComp);
0067     void AddFile(G4String fComp);
0068     void AddMaterial(std::vector<G4String> data);
0069     void AddMaterialDensity(std::vector<G4String> data);
0070     void AddCT2Density(std::vector<G4String> data);
0071 
0072     void Convert(G4String fFileName);
0073     void CheckNColumns(std::vector<G4String> wl, size_t vsizeTh);
0074     void ProcessFiles();
0075     void CheckCTSlices();
0076     G4double Hounsfield2density(Uint32 Hval);
0077     size_t GetMaterialIndex(G4double Hval);
0078     size_t GetMaterialIndexByDensity(G4double density);
0079     void BuildCTMaterials();
0080     void MergeCTFiles();
0081     void CheckPETSlices();
0082     void BuildPETActivities();
0083     void MergePETFiles();
0084     void DumpToTextFile();
0085     void SetStructureNCheck(G4int nsc) { theStructureNCheck = nsc; }
0086     G4int GetStructureNCheck() const { return theStructureNCheck; }
0087     void SetStructureNMaxROI(G4int nsc) { theStructureNMaxROI = nsc; }
0088     G4int GetStructureNMaxROI() const { return theStructureNMaxROI; }
0089     G4int GetCompression() const { return fCompression; }
0090     G4String GetFileOutName() const { return theFileOutName; }
0091 
0092     void SetControlPointMetersets();
0093     G4bool IsMaterialsDensity() const { return bMaterialsDensity; }
0094 
0095   protected:
0096     G4int fCompression;
0097 
0098   private:
0099     static DicomFileMgr* theInstance;
0100 
0101     G4String theFileOutName;
0102     //  msd theFiles;
0103     mdct theCTFiles;
0104     std::vector<DicomFileStructure*> theStructFiles;
0105     std::vector<DicomFilePlan*> thePlanFiles;
0106     mdpet thePETFiles;
0107     std::map<G4double, G4String> theMaterials;
0108     std::map<G4double, G4String> theMaterialsDensity;
0109     std::map<G4int, G4double> theCT2Density;
0110 
0111     DicomFileCT* theCTFileAll;
0112     DicomFilePET* thePETFileAll;
0113     G4int theStructureNCheck;
0114     G4int theStructureNMaxROI;
0115 
0116   public:
0117     static G4int verbose;
0118     G4bool bMaterialsDensity;
0119 };
0120 
0121 #endif