Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: Oct. 12, 2009 Akinori Kimura
|
||||
//
|
||||
// mapping data of CT values [H.U.] to densities [g/cm3]
|
||||
//
|
||||
#ifndef G4GMocrenFile_CTtoDensity_MAP_HH
|
||||
#define G4GMocrenFile_CTtoDensity_MAP_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GMocrenFileCTtoDensityMap {
|
||||
public:
|
||||
G4GMocrenFileCTtoDensityMap();
|
||||
~G4GMocrenFileCTtoDensityMap();
|
||||
|
||||
// get min. CT value
|
||||
G4int GetMinCT() const {return kCTMinMax[0];}
|
||||
// get max. CT value
|
||||
G4int GetMaxCT() const {return kCTMinMax[1];}
|
||||
// get density corresponding to CT value
|
||||
G4double GetDensity(G4int & _ct) const;
|
||||
|
||||
protected:
|
||||
G4int kCTMinMax[2];
|
||||
G4double * kDensity;
|
||||
G4int kSize;
|
||||
|
||||
private:
|
||||
// Private copy constructor and assigment operator - copying and
|
||||
// assignment not allowed. Keeps Coverity happy.
|
||||
G4GMocrenFileCTtoDensityMap (const G4GMocrenFileCTtoDensityMap&);
|
||||
G4GMocrenFileCTtoDensityMap& operator = (const G4GMocrenFileCTtoDensityMap&);
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,205 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: Mar. 31, 2009 Akinori Kimura
|
||||
//
|
||||
// Scene handler to export geometry and trajectories to a gMocren file.
|
||||
//
|
||||
#ifndef G4GMocrenFile_SCENE_HANDLER_HH
|
||||
#define G4GMocrenFile_SCENE_HANDLER_HH
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "G4THitsMap.hh"
|
||||
|
||||
class G4VisAttributes ;
|
||||
class G4GMocrenFile;
|
||||
class G4GMocrenMessenger;
|
||||
class G4GMocrenIO;
|
||||
class G4VSolid;
|
||||
class G4Polyhedron;
|
||||
class G4Colour;
|
||||
|
||||
//-----
|
||||
class G4GMocrenFileSceneHandler: public G4VSceneHandler {
|
||||
|
||||
friend class G4GMocrenFileViewer;
|
||||
|
||||
public:
|
||||
|
||||
//----- constructor and destructor
|
||||
G4GMocrenFileSceneHandler (G4GMocrenFile& system,
|
||||
G4GMocrenMessenger & messenger,
|
||||
const G4String& name = "");
|
||||
virtual ~G4GMocrenFileSceneHandler ();
|
||||
|
||||
//----- overriding base class methods
|
||||
using G4VSceneHandler::AddPrimitive;
|
||||
void AddPrimitive (const G4Polyline& line);
|
||||
void AddPrimitive (const G4Polyhedron& p);
|
||||
void AddPrimitive (const G4Text&);
|
||||
void AddPrimitive (const G4Circle&);
|
||||
void AddPrimitive (const G4Square&);
|
||||
|
||||
virtual void BeginModeling () { G4VSceneHandler::BeginModeling ();}
|
||||
virtual void EndModeling () { G4VSceneHandler::EndModeling ();}
|
||||
|
||||
virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
|
||||
virtual void EndPrimitives ();
|
||||
|
||||
using G4VSceneHandler::AddSolid;
|
||||
void AddSolid ( const G4Box& box );
|
||||
void AddSolid ( const G4Cons& cons );
|
||||
void AddSolid ( const G4Tubs& tubs );
|
||||
void AddSolid ( const G4Trd& trd );
|
||||
void AddSolid ( const G4Trap& trap );
|
||||
void AddSolid ( const G4Sphere& sphere );
|
||||
void AddSolid ( const G4Para& para );
|
||||
void AddSolid ( const G4Torus& torus );
|
||||
void AddSolid ( const G4VSolid& solid );
|
||||
|
||||
using G4VSceneHandler::AddCompound;
|
||||
void AddCompound ( const G4VTrajectory& traj);
|
||||
void AddCompound ( const G4VHit& hit);
|
||||
void AddCompound ( const G4VDigi& hit);
|
||||
void AddCompound ( const G4THitsMap<G4double> & hits);
|
||||
void AddCompound ( const G4THitsMap<G4StatDouble> & hits);
|
||||
|
||||
|
||||
void ClearTransientStore(); // Used for triggering detector re-drawing.
|
||||
|
||||
//----- public methods inherent to this class
|
||||
void GFBeginModeling () ;
|
||||
void GFEndModeling () ;
|
||||
G4bool GFIsInModeling () { return kFlagInModeling ; }
|
||||
|
||||
G4bool IsSavingGdd ( void ) { return kFlagSaving_g4_gdd ; }
|
||||
void BeginSavingGdd( void );
|
||||
void EndSavingGdd ( void ) ;
|
||||
void SetGddFileName() ;
|
||||
|
||||
G4GMocrenFile& GetSystem () { return kSystem ; }
|
||||
const char* GetGddFileName () { return kGddFileName ; }
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//----- initialize all parameters
|
||||
void InitializeParameters();
|
||||
|
||||
//----- Utilities etc.
|
||||
G4bool IsVisible();
|
||||
|
||||
//
|
||||
void AddDetector(const G4VSolid & solid);
|
||||
void ExtractDetector();
|
||||
|
||||
void GetNestedVolumeIndex(G4int, G4int[3]);
|
||||
|
||||
private:
|
||||
G4GMocrenFile& kSystem; // Graphics system for this scene.
|
||||
G4GMocrenMessenger & kMessenger;
|
||||
G4GMocrenIO * kgMocrenIO;
|
||||
|
||||
std::map<G4int, float> kModality;
|
||||
G4int kModalitySize[3];
|
||||
//std::map<G4ThreeVector, float> kModalityDensities; // key: position, val: density
|
||||
G4bool kbSetModalityVoxelSize;
|
||||
G4bool kbModelingTrajectory;
|
||||
|
||||
static G4int kSceneIdCount;
|
||||
//std::vector<float *> fTrajectories;
|
||||
//std::vector<unsigned char *> fTrajectoryColors;
|
||||
G4Transform3D kVolumeTrans3D;
|
||||
|
||||
class Detector {
|
||||
public:
|
||||
G4String name;
|
||||
G4Polyhedron * polyhedron;
|
||||
G4Transform3D transform3D;
|
||||
unsigned char color[3];
|
||||
Detector();
|
||||
~Detector();
|
||||
void clear();
|
||||
};
|
||||
std::vector<Detector> kDetectors;
|
||||
G4ThreeVector kVolumeSize;
|
||||
G4ThreeVector kVoxelDimension;
|
||||
std::vector<G4String> kNestedVolumeNames;
|
||||
G4int kNestedVolumeDimension[3];
|
||||
G4int kNestedVolumeDirAxis[3];
|
||||
|
||||
class Index3D {
|
||||
public:
|
||||
G4int x, y, z;
|
||||
|
||||
Index3D();
|
||||
Index3D(const Index3D & _index3D);
|
||||
Index3D(G4int _x, G4int _y, G4int _z);
|
||||
~Index3D(){;}
|
||||
G4bool operator < (const Index3D & _right) const;
|
||||
G4bool operator == (const Index3D & _right) const;
|
||||
private:
|
||||
// Private assigment operator -
|
||||
// assignment not allowed. Keeps Coverity happy.
|
||||
// Index3D& operator = (const Index3D&);
|
||||
};
|
||||
|
||||
std::map<Index3D, float> kNestedModality;
|
||||
//std::map<Index3D, G4double> * fTempNestedHits;
|
||||
std::map<G4String, std::map<Index3D, G4double> > kNestedHitsList;
|
||||
//std::map<G4String, G4String> kNestedHitsUnit;
|
||||
|
||||
std::ofstream kGddDest; // defined here
|
||||
G4bool kFlagInModeling;
|
||||
// true: GF_BEGIN_MODELING has sent to gMocrenFile, and
|
||||
// GF_END_MODELING has not sent yet.
|
||||
// false: otherwise
|
||||
//
|
||||
// kFlagInModeling is set to "true"
|
||||
// in GFBeginModeling(), and to "false"
|
||||
// in GFEndModeling().
|
||||
|
||||
G4bool kFlagSaving_g4_gdd ;
|
||||
|
||||
G4int kFlagParameterization; // 0: G4VNestedParameterisation based geometry
|
||||
// 1: G4PhantomParameterisation
|
||||
// 2: interactive scorer
|
||||
G4bool kFlagProcessedInteractiveScorer;
|
||||
|
||||
char kGddDestDir[256];
|
||||
char kGddFileName[256];
|
||||
G4int kMaxFileNum;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: Mar. 31, 2009 Akinori Kimura : release for the gMocrenFile driver
|
||||
//
|
||||
// GMocrenFile viewer - opens window, hard copy, etc.
|
||||
//
|
||||
#ifndef G4GMocrenFile_VIEWER_HH
|
||||
#define G4GMocrenFile_VIEWER_HH
|
||||
|
||||
#include "G4VViewer.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4GMocrenFileSceneHandler;
|
||||
class G4GMocrenMessenger;
|
||||
|
||||
class G4GMocrenFileViewer: public G4VViewer {
|
||||
public:
|
||||
//----- constructor and destructor
|
||||
G4GMocrenFileViewer (G4GMocrenFileSceneHandler& scene,
|
||||
G4GMocrenMessenger & messenger,
|
||||
const G4String& name = "");
|
||||
virtual ~G4GMocrenFileViewer ();
|
||||
|
||||
//----- overriding base class methods
|
||||
void SetView(); // Do nothing. SendViewParameters will do its job.
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
void ShowView();
|
||||
|
||||
//---- methods inherent to this class
|
||||
const char* GetG4GddViewer() { return kG4GddViewer;}
|
||||
const char* GetG4GddViewerInvocation() { return kG4GddViewerInvocation;}
|
||||
|
||||
private:
|
||||
G4GMocrenFileSceneHandler& kSceneHandler; // Reference to Graphics Scene for this view.
|
||||
|
||||
char kG4GddViewer[32] ;
|
||||
char kG4GddViewerInvocation[64] ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,467 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// File I/O manager class for writing or reading calcuated dose
|
||||
// distribution and some event information
|
||||
//
|
||||
//
|
||||
// Mar. 31, 2009 : release for the gMocrenFile driver
|
||||
//
|
||||
// Akinori Kimura
|
||||
//
|
||||
// gMocren home page:
|
||||
// http://geant4.kek.jp/gMocren/
|
||||
//
|
||||
#ifndef GMOCRENIO_HH
|
||||
#define GMOCRENIO_HH
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
|
||||
//
|
||||
//----- GMocrenDataPrimitive class -----//
|
||||
// data primitive class for volume data
|
||||
//
|
||||
template <typename T> class GMocrenDataPrimitive {
|
||||
protected:
|
||||
int kSize[3];
|
||||
double kScale;
|
||||
T kMinmax[2];
|
||||
float kCenter[3];
|
||||
std::vector<T *> kImage;
|
||||
std::string kDataName;
|
||||
//std::vector<std::vector<T>> image;
|
||||
|
||||
public:
|
||||
GMocrenDataPrimitive();
|
||||
//GMocrenDataPrimitive(GMocrenDataPrimitive<T> & _prim);
|
||||
~GMocrenDataPrimitive();
|
||||
|
||||
GMocrenDataPrimitive<T> & operator = (const GMocrenDataPrimitive<T> & _right);
|
||||
GMocrenDataPrimitive<T> & operator + (const GMocrenDataPrimitive<T> & _right);
|
||||
GMocrenDataPrimitive<T> & operator += (const GMocrenDataPrimitive<T> & _right);
|
||||
|
||||
void clear();
|
||||
void clearImage();
|
||||
void setSize(int _size[3]);
|
||||
void getSize(int _size[3]);
|
||||
void setScale(double & _scale);
|
||||
double getScale();
|
||||
void setMinMax(T _minmax[2]);
|
||||
void getMinMax(T _minmax[2]);
|
||||
void setImage(std::vector<T *> & _image);
|
||||
void addImage(T * _image);
|
||||
std::vector<T *> & getImage();
|
||||
T * getImage(int _z); // get image of each layer
|
||||
void setCenterPosition(float _center[3]);
|
||||
void getCenterPosition(float _center[3]);
|
||||
void setName(std::string & _name);
|
||||
std::string getName();
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
//----- GMocrenTrack class -----//
|
||||
//
|
||||
class GMocrenTrack {
|
||||
public:
|
||||
struct Step {
|
||||
float startPoint[3];
|
||||
float endPoint[3];
|
||||
};
|
||||
protected:
|
||||
std::vector<struct Step> kTrack;
|
||||
unsigned char kColor[3];
|
||||
|
||||
public:
|
||||
GMocrenTrack();
|
||||
~GMocrenTrack(){;}
|
||||
|
||||
|
||||
int getNumberOfSteps() {return (int)kTrack.size();}
|
||||
void addStep(float _startx, float _starty, float _startz,
|
||||
float _endx, float _endy, float _endz);
|
||||
void getStep(float & _startx, float & _starty, float & _startz,
|
||||
float & _endx, float & _endy, float & _endz,
|
||||
int _num);
|
||||
void setTrack(std::vector<struct Step> & _aTrack) {kTrack = _aTrack;}
|
||||
void setColor(unsigned char _color[3]) {
|
||||
for(int i = 0; i < 3; i++) kColor[i] = _color[i];
|
||||
}
|
||||
void getColor(unsigned char _color[3]) {
|
||||
for(int i = 0; i < 3; i++) _color[i] = kColor[i];
|
||||
}
|
||||
void translate(std::vector<float> & _tranlate);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
//----- GMocrenDetector class -----//
|
||||
//
|
||||
class GMocrenDetector {
|
||||
public:
|
||||
struct Edge {
|
||||
float startPoint[3];
|
||||
float endPoint[3];
|
||||
};
|
||||
protected:
|
||||
std::vector<struct Edge> kDetector;
|
||||
unsigned char kColor[3];
|
||||
std::string kName;
|
||||
|
||||
public:
|
||||
GMocrenDetector();
|
||||
~GMocrenDetector(){;}
|
||||
|
||||
|
||||
int getNumberOfEdges() {return (int)kDetector.size();}
|
||||
void addEdge(float _startx, float _starty, float _startz,
|
||||
float _endx, float _endy, float _endz);
|
||||
void getEdge(float & _startx, float & _starty, float & _startz,
|
||||
float & _endx, float & _endy, float & _endz,
|
||||
int _num);
|
||||
void setDetector(std::vector<struct Edge> & _aDetector) {kDetector = _aDetector;}
|
||||
void setColor(unsigned char _color[3]) {
|
||||
for(int i = 0; i < 3; i++) kColor[i] = _color[i];
|
||||
}
|
||||
void getColor(unsigned char _color[3]) {
|
||||
for(int i = 0; i < 3; i++) _color[i] = kColor[i];
|
||||
}
|
||||
void setName(std::string & _name) { kName = _name;}
|
||||
std::string getName() {return kName;}
|
||||
|
||||
void translate(std::vector<float> & _tranlate);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
//----- G4GMocrenIO class -----//
|
||||
//
|
||||
class G4GMocrenIO {
|
||||
public:
|
||||
// file id
|
||||
static std::string kId;
|
||||
|
||||
// file version
|
||||
static std::string kVersion;
|
||||
|
||||
// data file name
|
||||
static std::string kFileName;
|
||||
|
||||
// file data endian: little or not
|
||||
static char kLittleEndianInput;
|
||||
static char kLittleEndianOutput;
|
||||
|
||||
static std::string kComment;
|
||||
|
||||
// number of events
|
||||
static int kNumberOfEvents;
|
||||
|
||||
// pointer to the modality image data
|
||||
static unsigned int kPointerToModalityData;
|
||||
// pointer to the dose distribution image data
|
||||
static std::vector<unsigned int> kPointerToDoseDistData;
|
||||
// pointer to the ROI image data
|
||||
static unsigned int kPointerToROIData;
|
||||
// pointer to the track data
|
||||
static unsigned int kPointerToTrackData;
|
||||
// pointer to the detector data
|
||||
static unsigned int kPointerToDetectorData;
|
||||
|
||||
// voxel spacing (universal size)
|
||||
static float kVoxelSpacing[3];
|
||||
|
||||
//----- modality image -----//
|
||||
static class GMocrenDataPrimitive<short> kModality;
|
||||
// density map to modality (CT) values
|
||||
static std::vector<float> kModalityImageDensityMap;
|
||||
static std::string kModalityUnit;
|
||||
|
||||
//----- dose distribution -----//
|
||||
static std::vector<class GMocrenDataPrimitive<double> > kDose;
|
||||
//std::vector<short *> kShortDose;
|
||||
static std::string kDoseUnit;
|
||||
|
||||
//----- RoI -----//
|
||||
static std::vector<class GMocrenDataPrimitive<short> > kRoi;
|
||||
|
||||
//----- track information -----//
|
||||
static std::vector<float *> kSteps; // begin (x,y,z), end (x,y,z)
|
||||
static std::vector<unsigned char *> kStepColors; // r, g, b
|
||||
|
||||
static std::vector<class GMocrenTrack> kTracks;
|
||||
bool kTracksWillBeStored;
|
||||
|
||||
//----- detector information -----//
|
||||
static std::vector<class GMocrenDetector> kDetectors;
|
||||
|
||||
//----- verbose information -----//
|
||||
static int kVerbose; // verbose level : 0 - 5 (none - overtalk)
|
||||
|
||||
public:
|
||||
// constructor
|
||||
G4GMocrenIO();
|
||||
// destructor
|
||||
~G4GMocrenIO();
|
||||
|
||||
// initialize
|
||||
void initialize();
|
||||
|
||||
// set the gMocren data file name
|
||||
void setFileName(std::string & _filename) {kFileName = _filename;}
|
||||
void setFileName(char * _filename) {kFileName = _filename;}
|
||||
// get the gMocren data file name
|
||||
std::string & getFileName() {return kFileName;}
|
||||
// store all data in the gMocren data file
|
||||
bool storeData(char * _filename); // interface for version 4
|
||||
bool storeData();
|
||||
bool storeData2(char * _filename); // version 2
|
||||
bool storeData2();
|
||||
bool storeData3(char * _filename); // version 3
|
||||
bool storeData3();
|
||||
bool storeData4(char * _filename); // version 4
|
||||
bool storeData4();
|
||||
// retrieve all data from the gMocren data file
|
||||
bool retrieveData(char * _filename); // interface
|
||||
bool retrieveData();
|
||||
bool retrieveData2(char * _filename); //version 2
|
||||
bool retrieveData2();
|
||||
bool retrieveData3(char * _filename); // version 3
|
||||
bool retrieveData3();
|
||||
bool retrieveData4(char * _filename); // version 4
|
||||
bool retrieveData4();
|
||||
|
||||
// get & set the file id
|
||||
std::string & getID() {return kId;}
|
||||
void setID();
|
||||
void setID(std::string & _id) {kId = _id;}
|
||||
|
||||
// get & set the file version
|
||||
std::string & getVersion();
|
||||
void setVersion(std::string & _version);
|
||||
|
||||
// set endians of input/output data
|
||||
void setLittleEndianInput(bool _little);
|
||||
void setLittleEndianOutput(bool _little);
|
||||
|
||||
// get & set comment
|
||||
std::string & getComment() {return kComment;}
|
||||
void setComment(std::string & _comment) {kComment = _comment;}
|
||||
|
||||
|
||||
// voxel spacing
|
||||
void setVoxelSpacing(float _spacing[3]);
|
||||
void getVoxelSpacing(float _spacing[3]);
|
||||
|
||||
// get & set number of events
|
||||
int & getNumberOfEvents();
|
||||
void setNumberOfEvents(int & _numberOfEvents);
|
||||
void addOneEvent();
|
||||
|
||||
// set pointer the modality image data
|
||||
void setPointerToModalityData(unsigned int & _pointer);
|
||||
unsigned int getPointerToModalityData();
|
||||
// set pointer the dose distribution image data
|
||||
void addPointerToDoseDistData(unsigned int & _pointer);
|
||||
unsigned int getPointerToDoseDistData(int _elem = 0);
|
||||
// set pointer the ROI image data
|
||||
void setPointerToROIData(unsigned int & _pointer);
|
||||
unsigned int getPointerToROIData();
|
||||
// set pointer the track data
|
||||
void setPointerToTrackData(unsigned int & _pointer);
|
||||
unsigned int getPointerToTrackData();
|
||||
private:
|
||||
// calculate pointers
|
||||
void calcPointers4();
|
||||
void calcPointers3();
|
||||
void calcPointers2();
|
||||
|
||||
|
||||
//----- Modality image -----//
|
||||
public:
|
||||
// get & set the modality image size
|
||||
void getModalityImageSize(int _size[3]);
|
||||
void setModalityImageSize(int _size[3]);
|
||||
// get & set the modality image spacing size
|
||||
void getModalityImageVoxelSpacing(float _size[3]); // un-usable
|
||||
void setModalityImageVoxelSpacing(float _size[3]); // un-usable
|
||||
// get & set the modality image size
|
||||
void setModalityImageScale(double & _scale);
|
||||
double getModalityImageScale();
|
||||
// set the modality image in CT
|
||||
void setModalityImage(short * _image);
|
||||
short * getModalityImage(int _z);
|
||||
void clearModalityImage();
|
||||
// set/get the modality image density map
|
||||
void setModalityImageDensityMap(std::vector<float> & _map);
|
||||
std::vector<float> & getModalityImageDensityMap();
|
||||
// set the modality image min./max.
|
||||
void setModalityImageMinMax(short _minmax[2]);
|
||||
// get min. & max. of the modality image
|
||||
void getModalityImageMinMax(short _minmax[2]);
|
||||
short getModalityImageMax();
|
||||
short getModalityImageMin();
|
||||
// set center of the modality image position
|
||||
void setModalityCenterPosition(float _center[3]);
|
||||
void getModalityCenterPosition(float _center[3]);
|
||||
// get & set the modality image unit
|
||||
std::string getModalityImageUnit();
|
||||
void setModalityImageUnit(std::string & _unit);
|
||||
|
||||
short convertDensityToHU(float & _dens);
|
||||
|
||||
//----- Dose distribution -----//
|
||||
|
||||
// instanciate a dose distribution data object
|
||||
void newDoseDist();
|
||||
// get number of dose distribion data
|
||||
int getNumDoseDist();
|
||||
// get & set the dose distribution unit
|
||||
std::string getDoseDistUnit(int _num = 0);
|
||||
void setDoseDistUnit(std::string & _unit, int _num = 0);
|
||||
// get & set the dose distribution image size
|
||||
void getDoseDistSize(int _size[3], int _num = 0);
|
||||
void setDoseDistSize(int _size[3], int _num = 0);
|
||||
// get min. & max. of the dose distribution image
|
||||
void setDoseDistMinMax(short _minmax[2], int _num = 0);
|
||||
void getDoseDistMinMax(short _minmax[2], int _num = 0);
|
||||
// get min. & max. of the dose distribution
|
||||
void setDoseDistMinMax(double _minmax[2], int _num = 0);
|
||||
void getDoseDistMinMax(double _minmax[2], int _num = 0);
|
||||
// get & set scale value of the dose distribution for the image
|
||||
void setDoseDistScale(double & _scale, int _num = 0);
|
||||
double getDoseDistScale(int _num = 0);
|
||||
// set the dose distribution image
|
||||
void setShortDoseDist(short * _image, int _num = 0);
|
||||
void getShortDoseDist(short * _data, int _z, int _num = 0);
|
||||
void getShortDoseDistMinMax(short _minmax[2], int _num = 0);
|
||||
// set the dose distribution
|
||||
void setDoseDist(double * _image, int _num = 0);
|
||||
double * getDoseDist(int _z, int _num = 0);
|
||||
// add another dose ditribution map to this map
|
||||
bool addDoseDist(std::vector<double *> & _image, int _num = 0);
|
||||
|
||||
// get & get center position of calculated dose region
|
||||
void getDoseDistCenterPosition(float _center[3], int _num = 0);
|
||||
void setDoseDistCenterPosition(float _center[3], int _num = 0);
|
||||
|
||||
// get & get name of calculated dose distribution
|
||||
std::string getDoseDistName(int _num = 0);
|
||||
void setDoseDistName(std::string _name, int _num = 0);
|
||||
|
||||
// copy dose distributions
|
||||
void copyDoseDist(std::vector<class GMocrenDataPrimitive<double> > & _dose);
|
||||
// merge two dose distributions
|
||||
bool mergeDoseDist(std::vector<class GMocrenDataPrimitive<double> > & _dose);
|
||||
|
||||
// clear all dose distributions
|
||||
void clearDoseDistAll();
|
||||
protected:
|
||||
// check whether dose variable is empty or not
|
||||
bool isDoseEmpty();
|
||||
// calcuated scale value to convert dose distribution into image
|
||||
void calcDoseDistScale();
|
||||
|
||||
public:
|
||||
//----- RoI -----//
|
||||
|
||||
// instanciate an RoI data object
|
||||
void newROI();
|
||||
// get number of RoI data
|
||||
int getNumROI();
|
||||
// get & set the ROI image scale
|
||||
double getROIScale(int _num = 0);
|
||||
void setROIScale(double & _scale, int _num = 0);
|
||||
// get & set the ROI image
|
||||
short * getROI(int _z, int _num = 0);
|
||||
void setROI(short * _image, int _num = 0);
|
||||
// get & set the ROI image size
|
||||
void getROISize(int _size[3], int _num = 0);
|
||||
void setROISize(int _size[3], int _num = 0);
|
||||
// get & set position of the ROI region center
|
||||
void getROICenterPosition(float _center[3], int _num = 0);
|
||||
void setROICenterPosition(float _center[3], int _num = 0);
|
||||
// get & set the ROI image min. and max.
|
||||
void getROIMinMax(short _minmax[2], int _num = 0);
|
||||
void setROIMinMax(short _minmax[2], int _num = 0);
|
||||
void clearROIAll();
|
||||
protected:
|
||||
// check whether RoI variable is empty or not
|
||||
bool isROIEmpty();
|
||||
|
||||
|
||||
public:
|
||||
//----- Track -----//
|
||||
// get number of tracks
|
||||
int getNumTracks();
|
||||
int getNumTracks4();
|
||||
// get & set tracks
|
||||
std::vector<float *> & getTracks();
|
||||
void getTrack(int _num, std::vector<float *> & _steps,
|
||||
std::vector<unsigned char * > & _color);
|
||||
void addTrack(float * _tracks);
|
||||
void setTracks(std::vector<float *> & _tracks);
|
||||
std::vector<unsigned char *> & getTrackColors();
|
||||
void addTrackColor(unsigned char * _colors);
|
||||
void setTrackColors(std::vector<unsigned char *> & _trackColors);
|
||||
void copyTracks(std::vector<float *> & _tracks, std::vector<unsigned char *> & _colors);
|
||||
void mergeTracks(std::vector<float *> & _tracks, std::vector<unsigned char *> & _colors);
|
||||
void addTrack(std::vector<float *> & _steps, unsigned char _color[3]);
|
||||
|
||||
void notStoredTracks() {kTracksWillBeStored = false;};
|
||||
void translateTracks(std::vector<float> & _translateo);
|
||||
void clearTracks() {kTracks.clear();}
|
||||
|
||||
|
||||
//----- Detectors -----//
|
||||
// get number of detectors
|
||||
int getNumberOfDetectors();
|
||||
// add one detector which consists of edges (float[6])
|
||||
void addDetector(std::string & _name, std::vector<float *> & _det, unsigned char _color[3]);
|
||||
void getDetector(int _num, std::vector<float *> & _edges,
|
||||
std::vector<unsigned char *> & _color,
|
||||
std::string & _detectorName);
|
||||
void translateDetector(std::vector<float> & _translate);
|
||||
void clearDetector() {kDetectors.clear();}
|
||||
|
||||
protected:
|
||||
// endian conversion
|
||||
template <typename Type> void convertEndian(char *, Type &);
|
||||
// byte order inversion
|
||||
template <typename T> void invertByteOrder(char * _val, T & _rval);
|
||||
|
||||
|
||||
public:
|
||||
//----- verbose information -----//
|
||||
void setVerboseLevel(int _level);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: Mar. 31, 2009 Akinori Kimura
|
||||
//
|
||||
// UI command definition for gMocren-file driver.
|
||||
//
|
||||
#ifndef G4GMOCRENMESSENGER_HH
|
||||
#define G4GMOCRENMESSENGER_HH 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include <vector>
|
||||
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithoutParameter;
|
||||
|
||||
|
||||
class G4GMocrenMessenger : public G4UImessenger {
|
||||
|
||||
public:
|
||||
G4GMocrenMessenger();
|
||||
virtual ~G4GMocrenMessenger();
|
||||
|
||||
virtual G4String GetCurrentValue(G4UIcommand * command);
|
||||
virtual void SetNewValue(G4UIcommand * command, G4String newValue);
|
||||
|
||||
virtual G4String getEventNumberSuffix();
|
||||
virtual G4bool appendGeometry();
|
||||
virtual G4bool addPointAttributes();
|
||||
virtual G4bool useSolids();
|
||||
virtual G4bool writeInvisibles();
|
||||
virtual G4String getVolumeName();
|
||||
virtual std::vector<G4String> getHitNames();
|
||||
virtual G4String getScoringMeshName();
|
||||
virtual std::vector<G4String> getHitScorerNames();
|
||||
virtual void list();
|
||||
virtual void getNoVoxels(G4int & nx, G4int & ny, G4int & nz) const;
|
||||
virtual G4bool getDrawVolumeGrid() {return kDrawVolumeGrid;}
|
||||
|
||||
private:
|
||||
G4UIdirectory* kgMocrenDirectory;
|
||||
|
||||
G4String suffix;
|
||||
G4UIcmdWithAString* setEventNumberSuffixCommand;
|
||||
|
||||
G4bool geometry;
|
||||
G4UIcmdWithABool* appendGeometryCommand;
|
||||
|
||||
G4bool pointAttributes;
|
||||
G4UIcmdWithABool* addPointAttributesCommand;
|
||||
|
||||
G4bool solids;
|
||||
G4UIcmdWithABool* useSolidsCommand;
|
||||
|
||||
G4bool invisibles;
|
||||
|
||||
G4String kgMocrenVolumeName;
|
||||
G4UIcmdWithAString* kSetgMocrenVolumeNameCommand;
|
||||
|
||||
std::vector<G4String> kgMocrenHitNames;
|
||||
G4UIcmdWithAString* kAddgMocrenHitNameCommand;
|
||||
G4UIcmdWithoutParameter * kResetgMocrenHitNameCommand;
|
||||
|
||||
G4String kgMocrenScoringMeshName;
|
||||
G4UIcmdWithAString * kSetgMocrenScoringMeshNameCommand;
|
||||
|
||||
std::vector<G4String> kgMocrenHitScorerNames;
|
||||
G4UIcmdWithAString * kAddgMocrenHitScorerNameCommand;
|
||||
G4UIcmdWithoutParameter * kResetgMocrenHitScorerNameCommand;
|
||||
|
||||
G4int kgMocrenNoVoxels[3];
|
||||
G4UIcommand * kSetgMocrenNoVoxelsCommand;
|
||||
|
||||
G4UIcmdWithoutParameter * kListgMocrenCommand;
|
||||
|
||||
G4bool kDrawVolumeGrid;
|
||||
G4UIcmdWithABool* kDrawVolumeGridCommand;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// Created: Mar. 31, 2009 Akinori Kimura
|
||||
//
|
||||
// G4GMocrenTouchable class
|
||||
// is used to get densities of each box cell of patient geometry
|
||||
// defined by using the nest parameterisation.
|
||||
//
|
||||
#ifndef G4GMOCRENTOUCHABLE_HH
|
||||
#define G4GMOCRENTOUCHABLE_HH
|
||||
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
class G4GMocrenTouchable : public G4VTouchable {
|
||||
|
||||
public: // with description
|
||||
|
||||
G4GMocrenTouchable() {;}
|
||||
G4GMocrenTouchable(G4int & _depth0, G4int & _depth1);
|
||||
virtual ~G4GMocrenTouchable() {;}
|
||||
// Constructor and destructor.
|
||||
|
||||
virtual const G4ThreeVector& GetTranslation(G4int depth=0) const;
|
||||
virtual const G4RotationMatrix* GetRotation(G4int depth=0) const;
|
||||
// Accessors for translation and rotation.
|
||||
|
||||
virtual G4int GetReplicaNumber(G4int depth=0) const;
|
||||
// Methods for touchables with history.
|
||||
|
||||
void SetReplicaNumber(G4int _depth0, G4int _depth1);
|
||||
|
||||
private:
|
||||
G4int repno[2];
|
||||
};
|
||||
|
||||
inline
|
||||
G4GMocrenTouchable::G4GMocrenTouchable(G4int & _depth0, G4int & _depth1) {
|
||||
repno[0] = _depth0;
|
||||
repno[1] = _depth1;
|
||||
}
|
||||
|
||||
const G4ThreeVector& G4GMocrenTouchable::GetTranslation(G4int depth) const {
|
||||
// never used
|
||||
// in the purpose to avoid a warning in the compile process
|
||||
G4ThreeVector * vec = new G4ThreeVector();
|
||||
*vec *= static_cast<G4double>(depth);
|
||||
return *vec;
|
||||
}
|
||||
const G4RotationMatrix* G4GMocrenTouchable::GetRotation(G4int depth) const {
|
||||
// never used
|
||||
// in the puspose to avoid a warning in the compile process
|
||||
G4RotationMatrix * rot = new G4RotationMatrix();
|
||||
rot->setPhi(static_cast<G4double>(depth));
|
||||
return rot;
|
||||
}
|
||||
inline
|
||||
G4int G4GMocrenTouchable::GetReplicaNumber(G4int depth) const {
|
||||
if(depth > 1) {
|
||||
G4Exception("G4GMocrenTouchable::GetReplicaNumber(G4int)", "gMocren0001",
|
||||
FatalException, "depth number is less than 2.");
|
||||
}
|
||||
G4int rvalue;
|
||||
if(depth < 2) rvalue = depth;
|
||||
else rvalue = 0;
|
||||
return rvalue;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user