Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
dicom2.cc
이 파일의 문서화 페이지로 가기
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: $
27 //
30 
31 #ifdef G4MULTITHREADED
32 # include "G4MTRunManager.hh"
33 #else
34 # include "G4RunManager.hh"
35 #endif
36 #include "G4UImanager.hh"
37 #include "G4GenericPhysicsList.hh"
38 #include "G4tgrMessenger.hh"
39 #include "G4VisExecutive.hh"
40 #include "G4UIExecutive.hh"
41 #include "globals.hh"
42 #include "Randomize.hh"
43 #include "Shielding.hh"
44 #include "QGSP_BIC.hh"
45 #include "QBBC.hh"
46 
51 #include "DicomIntersectVolume.hh"
52 #ifdef G4_DCMTK
53 # include "DicomFileMgr.hh"
54 #else
55 # include "DicomHandler.hh"
56 #endif
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
60 int main(int argc,char** argv)
61 {
62  // Detect interactive mode (if no arguments) and define UI session
63  //
64  G4UIExecutive* ui = 0;
65  if (argc == 1)
66  ui = new G4UIExecutive(argc, argv);
67 
68  new G4tgrMessenger;
69  char* part = getenv("DICOM_PARTIAL_PARAM");
70  G4bool bPartial = (part && G4String(part) == "1") ? true : false;
71 
73  CLHEP::HepRandom::setTheSeed(24534575684783);
74  long seeds[2];
75  seeds[0] = 534524575674523;
76  seeds[1] = 526345623452457;
78 
79  // Construct the default run manager
80 #ifdef G4MULTITHREADED
81  char* nthread_c = getenv("DICOM_NTHREADS");
82  G4MTRunManager* runManager = new G4MTRunManager;
83  if(nthread_c)
84  runManager->SetNumberOfThreads(G4UIcommand::ConvertToDouble(nthread_c));
85 
86  G4cout << "\n\n\tDICOM2 running in multithreaded mode with "
87  << runManager->GetNumberOfThreads()
88  << " threads\n\n" << G4endl;
89 #else
90  G4RunManager* runManager = new G4RunManager;
91  G4cout << "\n\n\tDICOM running in serial mode\n\n" << G4endl;
92 #endif
93 
94  DicomDetectorConstruction* theGeometry = 0;
95 
96 #ifdef G4_DCMTK
97  DicomFileMgr* theFileMgr = 0;
98 #else
99  DicomHandler* dcmHandler = 0;
100 #endif
101 
102  if( !bPartial )
103  {
104 #ifdef G4_DCMTK
105  theFileMgr = DicomFileMgr::GetInstance();
106  theFileMgr->Convert("Data.dat");
107 #else
108  // Treatment of DICOM images before creating the G4runManager
109  dcmHandler = new DicomHandler;
110  dcmHandler->CheckFileFormat();
111 #endif
112 
113  // Initialisation of physics, geometry, primary particles ...
114  char* nest = getenv( "DICOM_NESTED_PARAM" );
115  if( nest && G4String(nest) == "1" ) {
116  theGeometry = new DicomNestedParamDetectorConstruction();
117  } else {
118  theGeometry = new DicomRegularDetectorConstruction();
119  }
120  } else {
121  theGeometry = new DicomPartialDetectorConstruction();
122  }
123  runManager->SetUserInitialization(theGeometry);
124 
125  // std::vector<G4String>* MyConstr = new std::vector<G4String>;
126  // MyConstr->push_back("G4EmStandardPhysics");
127  // G4VModularPhysicsList* phys = new G4GenericPhysicsList(MyConstr);
128  G4VModularPhysicsList* phys = new Shielding();
129  runManager->SetUserInitialization(phys);
130 
131  // User action initialization
133 
134  runManager->Initialize();
135 
136  new DicomIntersectVolume();
137 
138  // Initialize visualization
139  //
140  G4VisManager* visManager = new G4VisExecutive;
141  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
142  // G4VisManager* visManager = new G4VisExecutive("Quiet");
143  visManager->Initialize();
144 
145  // Get the pointer to the User Interface manager
146  G4UImanager* UImanager = G4UImanager::GetUIpointer();
147 
148  // Process macro or start UI session
149  //
150  if ( ! ui ) {
151  // batch mode
152  G4String command = "/control/execute ";
153  G4String fileName = argv[1];
154  UImanager->ApplyCommand(command+fileName);
155  }
156  else {
157  // interactive mode
158  UImanager->ApplyCommand("/control/execute vis.mac");
159  ui->SessionStart();
160  delete ui;
161  }
162 
163  // Job termination
164  // Free the store: user actions, physics_list and detector_description are
165  // owned and deleted by the run manager, so they should not be deleted
166  // in the main() program !
167 
168  delete visManager;
169  delete runManager;
170 
171  if( !bPartial )
172  {
173 #ifdef G4_DCMTK
174  delete theFileMgr;
175 #else
176  delete dcmHandler;
177 #endif
178  }
179 
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void SetNumberOfThreads(G4int n)
Definition of the DicomHandler class.
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:457
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:231
static DicomFileMgr * GetInstance()
Definition: DicomFileMgr.cc:41
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:466
#define G4endl
Definition: G4ios.hh:61
void Convert(G4String fFileName)
Definition: DicomFileMgr.cc:59
Action initialization class.
Definition of the DicomNestedParamDetectorConstruction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:73
G4int GetNumberOfThreads() const
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
bool G4bool
Definition: G4Types.hh:79
TString part[npart]
Definition: Style.C:32
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
Definition of the DicomRegularDetectorConstruction class.
Definition of the DicomIntersectVolume class.
Definition of the DicomPartialDetectorConstruction class.
int main(int argc, char **argv)
Definition: genwindef.cc:359
void CheckFileFormat()
G4GLOB_DLL std::ostream G4cout
void Initialize()
static void setTheSeeds(const long *seeds, int aux=-1)
Definition: Random.cc:241
Manages intersections of DICOM files with volumes.
TShielding< G4VModularPhysicsList > Shielding
Definition: Shielding.hh:68
virtual void Initialize()
Definition of the Dicom2ActionInitialization class.