Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DicomDetectorConstruction.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: DicomDetectorConstruction.hh 101301 2016-11-14 11:19:22Z gcosmo $
27 //
30 //
31 
32 #ifndef DicomDetectorConstruction_h
33 #define DicomDetectorConstruction_h 1
34 
35 #include "globals.hh"
38 
39 #include <set>
40 #include <map>
41 
42 class G4Material;
43 class G4Box;
44 class G4LogicalVolume;
46 
47 //*******************************************************
57 //*******************************************************
58 
59 struct matInfo
60 {
64 };
65 
67 {
68 public:
69 
72 
73  virtual G4VPhysicalVolume* Construct();
74  // trigger the construction of the geometry
75 
76 protected:
78  // create the original materials
79 
80  void ReadPhantomData();
81  void ReadPhantomDataNew();
82  // read the DICOM files describing the phantom
83  void ReadVoxelDensities( std::ifstream& fin );
84 
85  void ReadPhantomDataFile(const G4String& fname);
86  // read one of the DICOM files describing the phantom (usually one per Z slice).
87  // Build a DicomPhantomZSliceHeader for each file
88 
89  void MergeZSliceHeaders();
90  // merge the slice headers of all the files
91 
93  float density, G4String newMateName );
94  // build a new material if the density of the voxel is different to the other voxels
95 
98  virtual void ConstructPhantom() = 0;
99  // construct the phantom volumes.
100  // This method should be implemented for each of the derived classes
101 
102  void SetScorer(G4LogicalVolume* voxel_logic);
103 
104  virtual void ConstructSDandField();
105 
106 protected:
108 
109  // World ...
113 
117 
118  G4int fNoFiles; // number of DICOM files
119  std::vector<G4Material*> fOriginalMaterials; // list of original materials
120  std::vector<G4Material*> fMaterials;
121  // list of new materials created to distinguish different density
122  // voxels that have the same original materials
123  size_t* fMateIDs; // index of material of each voxel
124  //unsigned int* fMateIDs; // index of material of each voxel
125 
126  std::map<G4int,G4double> fDensityDiffs;
127  // Density difference to distinguish material for each original material (by index)
128 
129  std::vector<DicomPhantomZSliceHeader*> fZSliceHeaders;
130  // list of z slice header (one per DICOM files)
132  // z slice header resulted from merging all z slice headers
133 
136  G4double fMinX,fMinY,fMinZ; // minimum extension of voxels (position of wall)
137  G4double fMaxX,fMaxY,fMaxZ; // maximum extension of voxels (position of wall)
138 
139  std::map<G4int,G4Material*> thePhantomMaterialsOriginal;
140  // map numberOfMaterial to G4Material. They are the list of materials as built from .geom file
141 
143 
144  std::set<G4LogicalVolume*> fScorers;
145 
147 };
148 
149 #endif
150 
void SetScorer(G4LogicalVolume *voxel_logic)
std::set< G4LogicalVolume * > fScorers
Definition: G4Box.hh:64
std::vector< DicomPhantomZSliceHeader * > fZSliceHeaders
virtual G4VPhysicalVolume * Construct()
int G4int
Definition: G4Types.hh:78
DicomPhantomZSliceHeader * fZSliceHeaderMerged
void ReadVoxelDensities(std::ifstream &fin)
G4Material * BuildMaterialWithChangingDensity(const G4Material *origMate, float density, G4String newMateName)
bool G4bool
Definition: G4Types.hh:79
DicomPhantomZSliceMerged * fMergedSlices
string fname
Definition: test.py:308
Definition of the DicomPhantomZSliceHeader class.
double G4double
Definition: G4Types.hh:76
std::vector< G4Material * > fMaterials
std::vector< G4Material * > fOriginalMaterials
void ReadPhantomDataFile(const G4String &fname)
virtual void ConstructPhantom()=0
std::map< G4int, G4double > fDensityDiffs
std::map< G4int, G4Material * > thePhantomMaterialsOriginal