Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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

int main ( int  argc,
char **  argv 
)

Definition at line 86 of file DICOM.cc.

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

Here is the call graph for this function: