Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -1,109 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************
//
//
// DicomConfiguration.hh :
// - Handling of the header of *.g4 files
// - Reading <Data.dat> file
#ifndef DicomConfiguration_h
#define DicomConfiguration_h 1
#include "globals.hh"
#include <vector>
class DicomConfiguration
{
public:
DicomConfiguration();
~DicomConfiguration() { }
// This function reads <Data.dat>, return true or false
// if successfull or not
G4bool ReadDataFile();
G4int GetCompressionValue() {return compressionValue;}
G4int GetTotalNumberOfFile() {return totalNumberOfFile;}
std::vector<G4String> GetListOfFile() {return listOfFile;}
G4int GetTotalRows() {return totalRows;}
G4int GetTotalColumns() {return totalColumns;}
G4int GetTotalPixels() {return totalPixels;}
//G4int GetTotalPixels() {return densityValue.size();}
G4double GetXPixelSpacing() {return xPixelSpacing;}
G4double GetYPixelSpacing() {return yPixelSpacing;}
G4double GetSliceThickness() {return sliceTickness;}
std::vector<G4double> GetSliceLocation() {return sliceLocation;}
G4int IsCompressionUsed() {return compressionUsed;}
G4double GetDensityValue(G4int i);
void ClearDensityData() {densityValue.clear(); };
G4int ReadG4File(G4String g4File);
private:
static short compressionValue;
static G4int totalNumberOfFile;
static std::vector<G4String> listOfFile;
static short totalRows;
static short totalColumns;
static G4int totalPixels;
static G4double xPixelSpacing;
static G4double yPixelSpacing;
static G4double sliceTickness;
static std::vector<G4double> sliceLocation;
static short compressionUsed;
static std::vector<G4double> densityValue;
};
#endif
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: P. Arce
// History: 30.11.07 First version
//*******************************************************
//
// DicomDetectorConstruction.hh :
// - Start the building of the geometry
// - Initialisation of materials
// - Creation of the world
// - Reading of the DICOM data
//*******************************************************
#ifndef DicomDetectorConstruction_h
#define DicomDetectorConstruction_h 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "DicomPatientZSliceHeader.hh"
class G4Material;
class G4Box;
class G4LogicalVolume;
class DicomDetectorConstruction : public G4VUserDetectorConstruction
{
public:
DicomDetectorConstruction();
~DicomDetectorConstruction();
G4VPhysicalVolume* Construct();
// trigger the construction of the geometry
protected:
void InitialisationOfMaterials();
// create the original materials
void ReadPatientData();
// read the DICOM files describing the patient
void ReadPatientDataFile(const G4String& fname);
// read one of the DICOM files describing the patient (usually one per Z slice). Build a DicomPatientZSliceHeader for each file
void MergeZSliceHeaders();
// merge the slice headers of all the files
G4Material* BuildMaterialWithChangingDensity( const G4Material* origMate, float density, G4String newMateName );
// build a new material if the density of the voxel is different to the other voxels
G4String ftoa(float flo);
// convert a float to a string
void ConstructPatientContainer();
virtual void ConstructPatient() = 0;
// construct the patient volumes. This method should be implemented for each of the derived classes
protected:
G4Material* air;
// World ...
G4Box* world_solid;
G4LogicalVolume* world_logic;
G4VPhysicalVolume* world_phys;
G4Box* container_solid;
G4LogicalVolume* container_logic;
G4VPhysicalVolume* container_phys;
G4int fNoFiles; // number of DICOM files
std::vector<G4Material*> fOriginalMaterials; // list of original materials
std::vector<G4Material*> fMaterials; // list of new materials created to distinguish different density voxels that have the same original materials
size_t* fMateIDs; // index of material of each voxel
std::map<G4int,G4double> fDensityDiffs; // Density difference to distinguish material for each original material (by index)
std::vector<DicomPatientZSliceHeader*> fZSliceHeaders; // list of z slice header (one per DICOM files)
DicomPatientZSliceHeader* fZSliceHeaderMerged; // z slice header resulted from merging all z slice headers
G4int nVoxelX, nVoxelY, nVoxelZ;
G4double voxelHalfDimX, voxelHalfDimY, voxelHalfDimZ;
};
#endif
@@ -1,102 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
//*******************************************************
//
// DicomGeometry.hh :
// - Start the building of the geometry
// - Creation of the world and other "mother"(middle) volume
// - Initialisation of patient geometry
// - Initialisation of HeaD geometry
// - Functions are in DicomGeometry.cc, PatientConstructor.cc
//*******************************************************
#ifndef DicomGeometry_h
#define DicomGeometry_h 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
class DicomConfiguration;
class DicomPatientConstructor;
class G4Material;
class G4LogicalVolume;
class G4PhysicalVolume;
class G4Box;
class DicomGeometry : public G4VUserDetectorConstruction
{
public:
DicomGeometry();
~DicomGeometry();
G4VPhysicalVolume* Construct();
private:
void InitialisationOfMaterials();
void PatientConstruction();
DicomPatientConstructor* patientConstructor;
//Materials ...
G4Material* trabecularBone;
G4Material* denseBone;
G4Material* liver;
G4Material* muscle;
G4Material* phantom;
G4Material* breast;
G4Material* adiposeTissue;
G4Material* lungexhale;
G4Material* lunginhale;
G4Material* air;
// World ...
G4Box* solidWorld;
G4LogicalVolume* logicWorld;
G4VPhysicalVolume* physiWorld;
G4VPhysicalVolume* parameterisedPhysVolume;
G4VPhysicalVolume* physicalLungINhale;
};
#endif
@@ -57,6 +57,8 @@
#define DicomHandler_h 1
#include <cstdio>
#include <map>
#include <fstream>
#include "globals.hh"
@@ -68,17 +70,17 @@ public:
~DicomHandler();
G4int readHeader(FILE *,char *);
G4int readData(FILE *,char *); // note: always use readHeader
G4int ReadFile(FILE *,char *);
G4int ReadData(FILE *,char *); // note: always use readHeader
// before readData
// use ImageMagick to display the image
//G4int displayImage(char[500]);
void checkFileFormat();
void CheckFileFormat();
private:
template <class Type> void getValue(char *, Type &);
template <class Type> void GetValue(char *, Type &);
private:
@@ -86,12 +88,14 @@ private:
const int LINEBUFFSIZE;
const int FILENAMESIZE;
void storeInformation(char *);
void getInformation(G4int &, char *);
G4double pixel2density(G4int pixel);
void GetInformation(G4int &, char *);
G4double Pixel2density(G4int pixel);
void ReadMaterialIndices( std::ifstream& finData);
size_t GetMaterialIndex( G4double density );
void StoreData(std::ofstream& foutG4DCM);
short compression;
G4int max;
G4int nFiles;
short rows;
short columns;
short bitAllocated;
@@ -105,6 +109,9 @@ private:
G4bool littleEndian, implicitEndian;
short pixelRepresentation;
G4int** tab;
std::map<G4double,G4String> fMaterialIndices;
};
#endif
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef RE02NESTEDPARAMETERISATION_HH
#define RE02NESTEDPARAMETERISATION_HH
#include "G4Types.hh"
#include "G4VNestedParameterisation.hh"
#include "G4ThreeVector.hh"
#include <vector>
class G4VPhysicalVolume;
class G4VTouchable;
class G4VSolid;
class G4Material;
// CSG Entities which may be parameterised/replicated
//
class G4Box;
class G4Tubs;
class G4Trd;
class G4Trap;
class G4Cons;
class G4Sphere;
class G4Orb;
class G4Torus;
class G4Para;
class G4Polycone;
class G4Polyhedra;
class G4Hype;
class DicomNestedPhantomParameterisation: public G4VNestedParameterisation
{
public: // with description
DicomNestedPhantomParameterisation(const G4ThreeVector& voxelSize,
std::vector<G4Material*>& mat);
virtual ~DicomNestedPhantomParameterisation();
// Methods required in derived classes
// -----------------------------------
virtual G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol,
const G4int repNo,
const G4VTouchable *parentTouch=0
);
// Required method, as it is the reason for this class.
// Must cope with parentTouch=0 for navigator's SetupHierarchy
virtual G4int GetNumberOfMaterials() const;
virtual G4Material* GetMaterial(G4int idx) const;
// Needed to define materials for instances of Nested Parameterisation
// Current convention: each call should return the materials
// of all instances with the same mother/ancestor volume.
size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
size_t GetMaterialIndex( size_t copyNo) const;
void SetMaterialIndices( size_t* matInd ){
fMaterialIndices = matInd; }
void SetNoVoxel( size_t nx, size_t ny, size_t nz );
virtual void ComputeTransformation(const G4int no,
G4VPhysicalVolume *currentPV) const;
// Methods optional in derived classes
// -----------------------------------
// Additional standard Parameterisation methods,
// which can be optionally defined, in case solid is used.
virtual void ComputeDimensions(G4Box &,
const G4int,
const G4VPhysicalVolume *) const;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Tubs&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*)
const {}
void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*)
const {}
private:
G4double fdX,fdY,fdZ;
G4int fnX,fnY,fnZ;
//
std::vector<G4Material*> fMaterials;
size_t* fMaterialIndices;
// Index in fMaterials that correspond to each voxel.
};
#endif
@@ -1,100 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
//
//---------------------------------------------------------------------------
/// Octree encapsulates a volumetric compressed representation of the
/// vector field used for the reconstruction of a 3D model from multiple
/// range images or curves.
///
/// It is assumed that the space occupied by octree is a cube whose
/// bottom-left-front corner is at origin (0,0,0) while the opposite corner
/// (top,right,back) is at ( mSize,mSize,mSize). Resolution of an octree
/// denotes the number of voxels along each axis such
/// that the resolution = 2^mNoLevels.
// -------------------------------------------------------------------------
#ifndef DICOMOCTREE_HH
#define DICOMOCTREE_HH
#include "globals.hh"
#include "DicomOctreeNode.hh"
#include "DicomOctreeMiddleNode.hh"
#include "DicomOctreeTerminalNode.hh"
class DicomOctreeNode;
class DicomOctreeMiddleNode;
class DicomTerminalNode;
class DicomOctree;
class DicomOctree
{
public:
DicomOctree( G4int noLevels, G4double size );
~DicomOctree();
DicomOctreeNode* CreateNode( G4double i, G4double j, G4double k, G4int level );
DicomOctreeNode* operator()( G4double nodeX, G4double nodeY,
G4double nodeZ, G4int level );
void DeleteTree();
G4int CountMemory( G4int rMiddle, G4int rTerminal );
DicomOctreeNode* Root() { return mRoot; }
G4double Size() { return mSize; }
G4int NoLevels() { return mNoLevels; }
//G4bool Resolution() { return ( 1 << mNoLevels ); }
G4int GetIndexChild() { return indexChild;}
private:
void CountRecursive( DicomOctreeNode* pNode, G4int rMiddle, G4int rTerminal );
// Root node of the tree
DicomOctreeMiddleNode* mRoot;
// In an octree, size denotes physical size of the cube,
// ie length of its sides (which are assumed equal).
G4double mSize;
// Number of levels denotes the maximal number of
// nodes in a single branch, starting from the root node.
G4int mNoLevels;
G4int indexChild;
};
#endif
@@ -1,75 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
#ifndef DICOMOCTREENODE_H
#define DICOMOCTREENODE_H
#include "globals.hh"
enum OctreeNodeType { MIDDLE_NODE, TERMINAL_NODE };
// OctreeNode represents a single node in the Octree.
class DicomOctreeNode
{
public:
DicomOctreeNode();
~DicomOctreeNode();
DicomOctreeNode( DicomOctreeNode* pParent );
G4double Density(){return mDensity;}
virtual DicomOctreeNode*& operator []( G4int index ) = 0;
virtual OctreeNodeType Type() = 0;
const DicomOctreeNode* Parent(){ return mParent; }
virtual G4int FindChild( const DicomOctreeNode* pNode ) = 0;
static G4int InstanceCounter() { return mInstanceCounter; }
virtual G4int MemSize() = 0;
private:
static G4int mInstanceCounter;
DicomOctreeNode* mParent;
G4double mDensity;
};
#endif
@@ -1,189 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
#ifndef DicomPatientParameterisation_h
#define DicomPatientParameterisation_h 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4Box;
class G4Material;
class G4VisAttributes;
class DicomConfiguration;
class DicomPatientParameterisation : public G4VPVParameterisation
{
public:
DicomPatientParameterisation(G4int NoVoxels,
G4double maxDensity,
G4double minDensity ,
G4Material* lunginhale,
G4Material* lungexhale,
G4Material* adipose,
G4Material* breast,
G4Material* phantom,
G4Material* muscle,
G4Material* liver,
G4Material* denseBone,
G4Material* trabecularBone);
virtual ~DicomPatientParameterisation();
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume* physVol) const;
void ComputeDimensions(G4Box&,
const G4int,
const G4VPhysicalVolume* ) const;
void ComputeDimensions(G4Tubs &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Trd &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Trap &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Cons &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Sphere &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Orb &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Torus &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Para &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Polycone &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Polyhedra &,
const G4int,
const G4VPhysicalVolume *) const {}
void ComputeDimensions(G4Hype &,
const G4int,
const G4VPhysicalVolume *) const {}
G4Material* ComputeMaterial(const G4int copyNo,
G4VPhysicalVolume* physVol,
const G4VTouchable*);
void GetDensity( G4double maxDensity, G4double minDensity );
private:
//materials ...
G4Material* lungExhale;
G4Material* lungInhale;
G4Material* adiposeTissue;
G4Material* breastTissue;
G4Material* phantomTissue;
G4Material* muscleTissue;
G4Material* liverTissue;
G4Material* denseBoneTissue;
G4Material* trabecularBoneTissue;
G4VisAttributes* attributeAir;
G4VisAttributes* attributeLungINhale;
G4VisAttributes* attributeLungEXhale;
G4VisAttributes* attributeAdipose;
G4VisAttributes* attributeBreast;
G4VisAttributes* attributePhantom;
G4VisAttributes* attributeMuscle;
G4VisAttributes* attributeLiver;
G4VisAttributes* attributeTrabecularBone;
G4VisAttributes* attributeDenseBone;
G4int max;
short compression;
FILE* readData;
short columns,rows;
G4double pixelSpacingX;
G4double pixelSpacingY;
G4double sliceThickness;
G4double sliceLocation;
std::vector<G4double> density;
std::vector<G4double> patientPlacementX;
std::vector<G4double> patientPlacementY;
std::vector<G4double> patientPlacementZ;
//G4LogicalVolume* LogicalVolumeParam;
G4double middleLocationValue;
private:
void readColorChart();
class ColorChart {
public:
G4double density;
G4double color[3];
G4double alpha;
enum {CRED, CGREEN, CBLUE};
};
std::vector<ColorChart> colorChart;
G4int numColorChart;
G4double getChartColor(G4int, G4double density);
};
#endif
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: P. Arce
// History: 30.11.07 First version
//*******************************************************
//
// DicomPatientZSliceHeader.hh :
// - Contains the meta data information corresponding to one or several Z slices (number of voxels, dimension)
//*******************************************************
#ifndef DicomPatientZSliceHeader_h
#define DicomPatientZSliceHeader_h 1
#include "globals.hh"
class G4material;
#include <fstream>
#include <vector>
class DicomPatientZSliceHeader
{
public:
DicomPatientZSliceHeader( const DicomPatientZSliceHeader& rhs );
// build object copying an existing one (except Z dimensions)
DicomPatientZSliceHeader( std::ifstream& fin );
// build object reading data from a file
~DicomPatientZSliceHeader(){};
// Get and set methods
G4int GetNoVoxelX() const { return fNoVoxelX; };
G4int GetNoVoxelY() const { return fNoVoxelY; };
G4int GetNoVoxelZ() const { return fNoVoxelZ; };
G4int GetNoVoxels() const { return fNoVoxelX*fNoVoxelY*fNoVoxelZ; };
G4double GetMinX() const { return fMinX; };
G4double GetMinY() const { return fMinY; };
G4double GetMinZ() const { return fMinZ; };
G4double GetMaxX() const { return fMaxX; };
G4double GetMaxY() const { return fMaxY; };
G4double GetMaxZ() const { return fMaxZ; };
G4double GetVoxelHalfX() const { return (fMaxX-fMinX)/fNoVoxelX/2.; };
G4double GetVoxelHalfY() const { return (fMaxY-fMinY)/fNoVoxelY/2.; };
G4double GetVoxelHalfZ() const { return (fMaxZ-fMinZ)/fNoVoxelZ/2.; };
std::vector<G4String> GetMaterialNames() const { return fMaterialNames; };
void SetNoVoxelX(const G4int val) { fNoVoxelX = val; }
void SetNoVoxelY(const G4int val) { fNoVoxelY = val; }
void SetNoVoxelZ(const G4int val) { fNoVoxelZ = val; }
void SetMinX(const G4double val) { fMinX = val; };
void SetMaxX(const G4double val) { fMaxX = val; };
void SetMinY(const G4double val) { fMinY = val; };
void SetMaxY(const G4double val) { fMaxY = val; };
void SetMinZ(const G4double val) { fMinZ = val; };
void SetMaxZ(const G4double val) { fMaxZ = val; };
void SetMaterialNames(std::vector<G4String>& mn ){ fMaterialNames = mn; }
void operator+=( const DicomPatientZSliceHeader& rhs );
DicomPatientZSliceHeader operator+( const DicomPatientZSliceHeader& rhs );
// add two slices that have the same dimensions, merging them in Z
private:
G4bool CheckMaterialExists( const G4String& mateName );
// check that material read exists as a G4Material
private:
G4int fNoVoxelX, fNoVoxelY, fNoVoxelZ; // number of voxels in each dimensions
G4double fMinX,fMinY,fMinZ; // minimum extension of voxels (position of wall)
G4double fMaxX,fMaxY,fMaxZ; // maximum extension of voxels (position of wall)
std::vector<G4String> fMaterialNames; // list of material names
};
#endif
@@ -23,45 +23,40 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
// class DicomPhantomParameterisationColour
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
#ifndef DicomPatientConstructor_h
#define DicomPatientConstructor_h 1
// Class description:
//
// Class inherited from G4PhantomParameterisation to provide different colour for each material
// History:
// - Created. P. Arce, 5 December 2007
// *********************************************************************
#include "globals.hh"
#ifndef DicomPhantomParameterisationColour_HH
#define DicomPhantomParameterisationColour_HH
class DicomPatientConstructor
#include <map>
#include "G4PhantomParameterisation.hh"
class G4VisAttributes;
class DicomPhantomParameterisationColour : public G4PhantomParameterisation
{
public:
public: // with description
DicomPhantomParameterisationColour();
~DicomPhantomParameterisationColour();
virtual G4Material* ComputeMaterial(const G4int repNo,
G4VPhysicalVolume *currentVol,
const G4VTouchable *parentTouch=0);
private:
void ReadColourData();
DicomPatientConstructor() {;}
~DicomPatientConstructor() {;}
G4int FindingNbOfVoxels(G4double maxDensity, G4double minDensity);
// Functions to use ROI (region of interest), contour usually drawn by the
// physician to identify tumor volume and organ at risk
// under development ...
// void readContour();
//G4bool isWithin(G4double,G4double,G4double);
private:
G4double pixelSpacingX;
G4double pixelSpacingY;
G4double sliceThickness;
G4double sliceLocation;
G4int lenc,lenr;
private:
std::map<G4String,G4VisAttributes*> fColours;
};
#endif
@@ -36,6 +36,9 @@
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//
// History: 30.11.07 P.Arce modified so that some particles reach patient voxels
//
//*******************************************************
#ifndef DicomPrimaryGeneratorAction_h
@@ -23,38 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
// Author: P. Arce
// History: 30.11.07 First version
//*******************************************************
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
#ifndef DicomOctreeTerminalNode_h
#define DicomOctreeTerminalNode_h
// NestedParamDicomDetectorConstruction.hh :
// - Construct the patient using DicomPhantomParameterisationColour
//*******************************************************
class DicomOctreeTerminalNode : public DicomOctreeNode
#ifndef NestedParamDicomDetectorConstruction_h
#define NestedParamDicomDetectorConstruction_h 1
#include "globals.hh"
#include "DicomDetectorConstruction.hh"
class NestedParamDicomDetectorConstruction : public DicomDetectorConstruction
{
public:
DicomOctreeTerminalNode(DicomOctreeNode* pParent );
~ DicomOctreeTerminalNode();
public:
// ---- MGP ---- Replace *& with proper design of the operator
DicomOctreeNode*& operator []( G4int index );
G4int MemSize();
OctreeNodeType Type() {return TERMINAL_NODE;}
G4int FindChild( const DicomOctreeNode* ) {return -1;}
NestedParamDicomDetectorConstruction();
~NestedParamDicomDetectorConstruction();
private:
static DicomOctreeNode* mNull;
virtual void ConstructPatient();
};
#endif
@@ -23,41 +23,32 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// The code was written by :
// *Louis Archambault louis.archambault@phy.ulaval.ca,
// *Luc Beaulieu beaulieu@phy.ulaval.ca
// +Vincent Hubert-Tremblay at tigre.2@sympatico.ca
// Author: P. Arce
// History: 30.11.07 First version
//*******************************************************
//
//
// *Centre Hospitalier Universitaire de Quebec (CHUQ),
// Hotel-Dieu de Quebec, departement de Radio-oncologie
// 11 cote du palais. Quebec, QC, Canada, G1R 2J6
// tel (418) 525-4444 #6720
// fax (418) 691 5268
//
// + Université Laval, Québec (QC) Canada
//*******************************************************//
#ifndef DicomOctreeMiddleNode_h
#define DicomOctreeMiddleNode_h
#include "globals.hh"
class DicomOctree;
// RegularDicomDetectorConstruction.hh :
// - Construct the patient using DicomPhantomParameterisationColour
//*******************************************************
class DicomOctreeMiddleNode : public DicomOctreeNode
#ifndef RegularDicomDetectorConstruction_h
#define RegularDicomDetectorConstruction_h 1
#include "globals.hh"
#include "DicomDetectorConstruction.hh"
class RegularDicomDetectorConstruction : public DicomDetectorConstruction
{
public:
DicomOctreeMiddleNode();
~DicomOctreeMiddleNode();
public:
void ResetFamily();
DicomOctreeMiddleNode( DicomOctreeNode* pParent );
G4int FindChild( const DicomOctreeNode* pNode );
G4int MemSize();
DicomOctreeNode*& operator []( G4int index ) {return mChildren[index];}
OctreeNodeType Type() {return MIDDLE_NODE;}
RegularDicomDetectorConstruction();
~RegularDicomDetectorConstruction();
private:
DicomOctreeNode* mChildren[8];
DicomOctree* octree;
virtual void ConstructPatient();
};
#endif