source: trunk/examples/extended/medical/DICOM/dicom.cc @ 1313

Last change on this file since 1313 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.1 KB
Line 
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// The code was written by :
27//      *Louis Archambault louis.archambault@phy.ulaval.ca,
28//      *Luc Beaulieu beaulieu@phy.ulaval.ca
29//      +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
30//
31//
32// *Centre Hospitalier Universitaire de Quebec (CHUQ),
33// Hotel-Dieu de Quebec, departement de Radio-oncologie
34// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
35// tel (418) 525-4444 #6720
36// fax (418) 691 5268
37//
38// + Université Laval, Québec (QC) Canada
39//*******************************************************//
40
41#include "globals.hh"
42#include "G4UImanager.hh"
43#include "G4UIterminal.hh"
44#include "G4RunManager.hh"
45#include "G4UItcsh.hh"
46#include "Randomize.hh"
47
48#include "DicomPhysicsList.hh"
49
50#ifdef G4VIS_USE
51#include "G4VisExecutive.hh"
52#endif
53
54#include "RegularDicomDetectorConstruction.hh"
55#include "NestedParamDicomDetectorConstruction.hh"
56#include "DicomPrimaryGeneratorAction.hh"
57#include "DicomEventAction.hh"
58#include "DicomRunAction.hh"
59#include "DicomHandler.hh"
60
61int main(int argc,char** argv)
62{
63                               
64  // Treatment of DICOM images before creating the G4runManager
65  DicomHandler* dcmHandler = new DicomHandler;
66  dcmHandler->CheckFileFormat();
67
68  // Initialisation of physics, geometry, primary particles ...
69  G4RunManager* runManager = new G4RunManager;
70  DicomDetectorConstruction* theGeometry;
71  char* nest = getenv( "DICOM_NESTED_PARAM" );
72  if( nest && G4String(nest) == "1" ) {
73    theGeometry = new NestedParamDicomDetectorConstruction();
74  } else {
75    theGeometry = new RegularDicomDetectorConstruction();
76  }
77  runManager->SetUserInitialization(new DicomPhysicsList);
78  runManager->SetUserInitialization(theGeometry);
79  runManager->SetUserAction(new DicomPrimaryGeneratorAction());
80  runManager->SetUserAction(new DicomRunAction);
81  runManager->SetUserAction(new DicomEventAction);
82
83  runManager->Initialize();
84
85#ifdef G4VIS_USE
86  // visualisation manager
87  G4VisManager* visManager = new G4VisExecutive;
88  visManager->Initialize();
89#endif
90
91  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
92
93  G4UImanager* UI = G4UImanager::GetUIpointer();
94 
95  if (argc==1)
96    {
97      G4UIsession* session = new G4UIterminal(new G4UItcsh);
98      UI->ApplyCommand("/control/execute vis.mac");
99      session->SessionStart();
100      delete session;
101    }
102  else
103    {
104      G4String command = "/control/execute ";
105      G4String fileName = argv[1];
106      UI->ApplyCommand(command+fileName);
107    }
108
109  delete runManager;
110
111#ifdef G4VIS_USE
112  delete visManager;
113#endif
114
115  delete dcmHandler;
116
117  return 0;
118}
119
120
121
122
Note: See TracBrowser for help on using the repository browser.