Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DICOM.cc
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 //
28 //
29 // The code was written by :
30 // *Louis Archambault louis.archambault@phy.ulaval.ca,
31 // *Luc Beaulieu beaulieu@phy.ulaval.ca
32 // +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
33 //
34 //
35 // *Centre Hospitalier Universitaire de Quebec (CHUQ),
36 // Hotel-Dieu de Quebec, departement de Radio-oncologie
37 // 11 cote du palais. Quebec, QC, Canada, G1R 2J6
38 // tel (418) 525-4444 #6720
39 // fax (418) 691 5268
40 //
41 // + Université Laval, Québec (QC) Canada
42 //*******************************************************//
43 
44 #include "globals.hh"
45 #include "G4UImanager.hh"
46 #include "G4RunManager.hh"
47 #include "Randomize.hh"
48 
49 #include "DicomPhysicsList.hh"
50 
55 #include "DicomEventAction.hh"
56 #include "DicomRunAction.hh"
57 #include "DicomHandler.hh"
58 #include "DicomIntersectVolume.hh"
59 #include "QGSP_BIC.hh"
60 #include "G4tgrMessenger.hh"
61 
62 #ifdef G4VIS_USE
63 #include "G4VisExecutive.hh"
64 #endif
65 
66 #ifdef G4UI_USE
67 #include "G4UIExecutive.hh"
68 #endif
69 
70 int main(int argc,char** argv)
71 {
72 
73  new G4tgrMessenger;
74  char* part = getenv( "DICOM_PARTIAL_PARAM" );
75  G4bool bPartial = FALSE;
76  if( part && G4String(part) == "1" ) {
77  bPartial = TRUE;
78  }
79 
80  G4RunManager* runManager = new G4RunManager;
81  DicomDetectorConstruction* theGeometry = 0;
82  DicomHandler* dcmHandler = 0;
83 
84  if( !bPartial ){
85  // Treatment of DICOM images before creating the G4runManager
86  dcmHandler = new DicomHandler;
87  dcmHandler->CheckFileFormat();
88 
89  // Initialisation of physics, geometry, primary particles ...
90  char* nest = getenv( "DICOM_NESTED_PARAM" );
91  if( nest && G4String(nest) == "1" ) {
92  theGeometry = new DicomNestedParamDetectorConstruction();
93  } else {
94  theGeometry = new DicomRegularDetectorConstruction();
95  }
96  } else {
97  theGeometry = new DicomPartialDetectorConstruction();
98  }
99 
100  // runManager->SetUserInitialization(new DicomPhysicsList);
101  runManager->SetUserInitialization(new QGSP_BIC);
102  runManager->SetUserInitialization(theGeometry);
103  runManager->SetUserAction(new DicomPrimaryGeneratorAction());
104  runManager->SetUserAction(new DicomRunAction);
105  runManager->SetUserAction(new DicomEventAction);
106 
107  runManager->Initialize();
108 
109  new DicomIntersectVolume();
110 
111 #ifdef G4VIS_USE
112  // visualisation manager
113  G4VisManager* visManager = new G4VisExecutive;
114  visManager->Initialize();
115 #endif
116 
118 
119  G4UImanager* UImanager = G4UImanager::GetUIpointer();
120 
121 
122  if (argc==1)
123  {
124 #ifdef G4UI_USE
125  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
126 #ifdef G4VIS_USE
127  UImanager->ApplyCommand("/control/execute vis.mac");
128 #endif
129  ui->SessionStart();
130  delete ui;
131 #endif
132  }
133  else
134  {
135  G4String command = "/control/execute ";
136  G4String fileName = argv[1];
137  UImanager->ApplyCommand(command+fileName);
138  }
139 
140  delete runManager;
141 
142 #ifdef G4VIS_USE
143  delete visManager;
144 #endif
145 
146  if( !bPartial ){
147  delete dcmHandler;
148  }
149 
150  return 0;
151 }
152 
153 
154 
155