Geant4  10.02.p03
DICOM.cc File Reference

Main program of the medical/DICOM example. More...

Include dependency graph for DICOM.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/DICOM example.

Definition in file DICOM.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 80 of file DICOM.cc.

81 {
82 
83  new G4tgrMessenger;
84  char* part = getenv( "DICOM_PARTIAL_PARAM" );
85  G4bool bPartial = FALSE;
86  if( part && G4String(part) == "1" ) {
87  bPartial = TRUE;
88  }
89 
91  CLHEP::HepRandom::setTheSeed(24534575684783);
92  long seeds[2];
93  seeds[0] = 534524575674523;
94  seeds[1] = 526345623452457;
96 
97  // Construct the default run manager
98 #ifdef G4MULTITHREADED
99  char* nthread_c = getenv("DICOM_NTHREADS");
100 
101  unsigned nthreads = 4;
102  unsigned env_threads = 0;
103 
104  if(nthread_c) { env_threads = G4UIcommand::ConvertToDouble(nthread_c); }
105  if(env_threads > 0) { nthreads = env_threads; }
106 
107  G4MTRunManager* runManager = new G4MTRunManager;
108  runManager->SetNumberOfThreads(nthreads);
109 
110  G4cout << "\n\n\tDICOM running in multithreaded mode with " << nthreads
111  << " threads\n\n" << G4endl;
112 
113 
114 #else
115  G4RunManager* runManager = new G4RunManager;
116  G4cout << "\n\n\tDICOM running in serial mode\n\n" << G4endl;
117 
118 #endif
119 
120  DicomDetectorConstruction* theGeometry = 0;
121  DicomHandler* dcmHandler = 0;
122 
123  if( !bPartial ){
124  // Treatment of DICOM images before creating the G4runManager
125  dcmHandler = new DicomHandler;
126  dcmHandler->CheckFileFormat();
127 
128  // Initialisation of physics, geometry, primary particles ...
129  char* nest = getenv( "DICOM_NESTED_PARAM" );
130  if( nest && G4String(nest) == "1" ) {
131  theGeometry = new DicomNestedParamDetectorConstruction();
132  } else {
133  theGeometry = new DicomRegularDetectorConstruction();
134  }
135  } else {
136  theGeometry = new DicomPartialDetectorConstruction();
137  }
138  runManager->SetUserInitialization(theGeometry);
139 
140  std::vector<G4String>* MyConstr = new std::vector<G4String>;
141  MyConstr->push_back("G4EmStandardPhysics");
142  G4VModularPhysicsList* phys = new G4GenericPhysicsList(MyConstr);
143  runManager->SetUserInitialization(phys);
144 
145  // Set user action classes
147 
148  runManager->Initialize();
149 
150  new DicomIntersectVolume();
151 
152 #ifdef G4VIS_USE
153  // visualisation manager
154  G4VisManager* visManager = new G4VisExecutive;
155  visManager->Initialize();
156 #endif
157 
158 
159  G4UImanager* UImanager = G4UImanager::GetUIpointer();
160 
161 
162  if (argc==1)
163  {
164 #ifdef G4UI_USE
165  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
166 #ifdef G4VIS_USE
167  UImanager->ApplyCommand("/control/execute vis.mac");
168 #endif
169  ui->SessionStart();
170  delete ui;
171 #endif
172  }
173  else
174  {
175  G4String command = "/control/execute ";
176  G4String fileName = argv[1];
177  UImanager->ApplyCommand(command+fileName);
178  }
179 
180  delete runManager;
181 
182 #ifdef G4VIS_USE
183  delete visManager;
184 #endif
185 
186  if( !bPartial ) { delete dcmHandler; }
187 
188  return 0;
189 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static void setTheSeeds(const long *seeds, int aux=-1)
Definition: Random.cc:142
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:132
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Manages intersections of DICOM files with volumes.
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define FALSE
Definition: globals.hh:52
TString part[npart]
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:443
#define TRUE
Definition: globals.hh:55
void Initialize()
TG4GenericPhysicsList< G4VModularPhysicsList > G4GenericPhysicsList
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:171
void CheckFileFormat()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
Here is the call graph for this function: