Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DicomPhantomZSliceMerged Class Reference

#include <DicomPhantomZSliceMerged.hh>

Public Member Functions

 DicomPhantomZSliceMerged ()
 
 ~DicomPhantomZSliceMerged ()
 
void AddZSlice (DicomPhantomZSliceHeader *val)
 
void CheckSlices ()
 
void DumpExcessMemory ()
 

Detailed Description

Definition at line 47 of file DicomPhantomZSliceMerged.hh.

Constructor & Destructor Documentation

DicomPhantomZSliceMerged::DicomPhantomZSliceMerged ( )

Definition at line 47 of file DicomPhantomZSliceMerged.cc.

48 {
49 
50 }
DicomPhantomZSliceMerged::~DicomPhantomZSliceMerged ( )

Definition at line 54 of file DicomPhantomZSliceMerged.cc.

55 {
56  fSlices.clear();
57 }

Member Function Documentation

void DicomPhantomZSliceMerged::AddZSlice ( DicomPhantomZSliceHeader val)
inline

Definition at line 56 of file DicomPhantomZSliceMerged.hh.

56  {
57  fSlices[val->GetSliceLocation()] = val;
58  }
const G4double & GetSliceLocation() const

Here is the call graph for this function:

Here is the caller graph for this function:

void DicomPhantomZSliceMerged::CheckSlices ( )

Definition at line 61 of file DicomPhantomZSliceMerged.cc.

62 {
63  G4cout << "\nDicomPhantomZSliceMerged::Checking "
64  << fSlices.size() << " fSlices..." << G4endl;
65 
66  G4bool uniformSliceThickness = true;
67 
68  if(fSlices.size() > 1) {
69  if(fSlices.size() == 2) {
70  DicomPhantomZSliceHeader* one = fSlices.begin()->second;
71  DicomPhantomZSliceHeader* two = fSlices.end()->second;
72 
73  G4double real_distance = (two->GetSliceLocation()-one->GetSliceLocation())/2.;
74 
75  if(one->GetMaxZ() != two->GetMinZ()) {
76  one->SetMaxZ(one->GetSliceLocation()+real_distance);
77  two->SetMinZ(two->GetSliceLocation()-real_distance);
78  //one->SetMinZ(one->GetSliceLocation()-real_distance);
79  //two->SetMaxZ(two->GetSliceLocation()+real_distance);
80  if(uniformSliceThickness) {
81  one->SetMinZ(one->GetSliceLocation()-real_distance);
82  two->SetMaxZ(two->GetSliceLocation()+real_distance);
83  }
84  }
85  } else {
86  std::map<G4double,DicomPhantomZSliceHeader*>::iterator ite0 = fSlices.begin();
87  std::map<G4double,DicomPhantomZSliceHeader*>::iterator ite1 = fSlices.begin();
88  std::map<G4double,DicomPhantomZSliceHeader*>::iterator ite2 = fSlices.begin();
89  ++ite1;
90  ++ite2; ++ite2;
91 
92  for(; ite2 != fSlices.end(); ++ite0, ++ite1, ++ite2) {
93  DicomPhantomZSliceHeader* prev = ite0->second;
94  DicomPhantomZSliceHeader* slice = ite1->second;
95  DicomPhantomZSliceHeader* next = ite2->second;
96  G4double real_max_distance = (next->GetSliceLocation() -
97  slice->GetSliceLocation())/2.;
98  G4double real_min_distance = (slice->GetSliceLocation() -
99  prev->GetSliceLocation())/2.;
100  G4double real_distance = real_max_distance + real_min_distance;
101  G4double stated_distance = slice->GetMaxZ()-slice->GetMinZ();
102  if(real_distance != stated_distance) {
103  unsigned int sliceNum = std::distance(fSlices.begin(),ite1);
104  G4cout << "\tDicomPhantomZSliceMerged::CheckSlices - \
105  Slice Distance Error in slice [" << sliceNum
106  << "]: Real Distance = "
107  << real_distance/mm
108  << " mm, Stated Distance = " << stated_distance/mm << G4endl;
109  slice->SetMinZ(slice->GetSliceLocation()-real_min_distance);
110  slice->SetMaxZ(slice->GetSliceLocation()+real_max_distance);
111 
112  if(ite0 == fSlices.begin()) {
113  prev->SetMaxZ(slice->GetMinZ());
114  // Using below would make all slice same thickness
115  //prev->SetMinZ(prev->GetSliceLocation()-real_min_distance);
116  if(uniformSliceThickness) {
117  prev->SetMinZ(prev->GetSliceLocation()-real_min_distance); }
118 
119  }
120  if(static_cast<unsigned int>(std::distance(fSlices.begin(),ite2)+1)==
121  fSlices.size()) {
122  next->SetMinZ(slice->GetMaxZ());
123  // Using below would make all slice same thickness
124  //next->SetMaxZ(next->GetSliceLocation()+real_max_distance);
125  if(uniformSliceThickness) {
126  next->SetMaxZ(next->GetSliceLocation()+real_max_distance); }
127  }
128  }
129  }
130  }
131  }
132  G4cout << G4endl;
133 
134  std::map<G4double,DicomPhantomZSliceHeader*>::iterator ite = fSlices.begin();
135  for(ite = fSlices.begin(); ite != fSlices.end(); ++ite) {
136  ite->second->DumpToFile();
137  }
138 
139 }
static constexpr double mm
Definition: G4SIunits.hh:115
void SetMinZ(const G4double &val)
const G4double & GetSliceLocation() const
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetMaxZ(const G4double &val)

Here is the call graph for this function:

Here is the caller graph for this function:

void DicomPhantomZSliceMerged::DumpExcessMemory ( )
inline

Definition at line 74 of file DicomPhantomZSliceMerged.hh.

75 {
76  for(std::map<G4double,DicomPhantomZSliceHeader*>::iterator ite = fSlices.begin();
77  ite != fSlices.end(); ++ite) {
78  ite->second->DumpExcessMemory();
79  }
80 }

The documentation for this class was generated from the following files: