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

Last change on this file since 1229 was 807, checked in by garnier, 16 years ago

update

File size: 4.0 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 "DicomHandler.hh"
59
60int main(int argc,char** argv)
61{
62                               
63  // Treatment of DICOM images before creating the G4runManager
64  DicomHandler* dcmHandler = new DicomHandler;
65  dcmHandler->CheckFileFormat();
66
67  // Initialisation of physics, geometry, primary particles ...
68  G4RunManager* runManager = new G4RunManager;
69  DicomDetectorConstruction* theGeometry;
70  char* nest = getenv( "DICOM_NESTED_PARAM" );
71  if( nest && G4String(nest) == "1" ) {
72    theGeometry = new NestedParamDicomDetectorConstruction();
73  } else {
74    theGeometry = new RegularDicomDetectorConstruction();
75  }
76  runManager->SetUserInitialization(new DicomPhysicsList);
77  runManager->SetUserInitialization(theGeometry);
78  runManager->SetUserAction(new DicomPrimaryGeneratorAction());
79  //  runManager->SetUserAction(new DicomEventAction);
80
81  runManager->Initialize();
82
83#ifdef G4VIS_USE
84  // visualisation manager
85  G4VisManager* visManager = new G4VisExecutive;
86  visManager->Initialize();
87#endif
88
89  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
90
91  G4UImanager* UI = G4UImanager::GetUIpointer();
92 
93  if (argc==1)
94    {
95      G4UIsession* session = new G4UIterminal(new G4UItcsh);
96      UI->ApplyCommand("/control/execute vis.mac");
97      session->SessionStart();
98      delete session;
99    }
100  else
101    {
102      G4String command = "/control/execute ";
103      G4String fileName = argv[1];
104      UI->ApplyCommand(command+fileName);
105    }
106
107  delete runManager;
108
109#ifdef G4VIS_USE
110  delete visManager;
111#endif
112
113  delete dcmHandler;
114
115  return 0;
116}
117
118
119
120
Note: See TracBrowser for help on using the repository browser.