53    fPhantomMinusCorner(),
 
   58                   "voxels that are totally inside the intersection as a new phantom " 
   59                   "file. It must have the parameters: POS_X POS_Y POS_Z " 
   60                   "ANG_X ANG_Y ANG_Z SOLID_TYPE SOLID_PARAM_1 (SOLID_PARAM_2 ...)");
 
   66                 "voxels that are totally inside the intersection as a new phantom " 
   67                 "file. It must have the parameters: POS_X POS_Y POS_Z " 
   68                 "ANG_X ANG_Y ANG_Z SOLID_TYPE SOLID_PARAM_1 (SOLID_PARAM_2 ...)");
 
   89     if( params.size() < 8 ) {
 
   91                   " There must be at least 8 parameter: SOLID_TYPE POS_X POS_Y POS_Z " 
   92           "ANG_X ANG_Y ANG_Z SOLID_PARAM_1 (SOLID_PARAM_2 ...)",
 
   94                   G4String(
"Number of parameters given = " + 
 
  107     std::vector<double> angles; 
 
  115     if( params.size() !=1 ) 
G4Exception(
"DicomIntersectVolume::SetNewValue",
 
  121                          "  needs 1 argument: VOLUME_NAME").c_str()); 
 
  150   G4String thePhantomFileName = 
"phantom.g4pdcm";
 
  151   fout.open(thePhantomFileName);
 
  152   std::vector<G4Material*> materials = thePhantomParam->
GetMaterials();
 
  154   for( 
unsigned int ii = 0; ii < materials.size(); ii++ ) {
 
  155     fout << ii << 
" " << materials[ii]->GetName() << 
G4endl;
 
  169   fout << nx << 
" " << ny << 
" " << nz << 
G4endl;
 
  170   fout << -voxelHalfWidthX*nx+thePhantomTransform.NetTranslation().x() << 
" "   
  171        << voxelHalfWidthX*nx+thePhantomTransform.NetTranslation().x() << 
G4endl;
 
  172   fout << -voxelHalfWidthY*ny+thePhantomTransform.NetTranslation().y() << 
" "  
  173        << voxelHalfWidthY*ny+thePhantomTransform.NetTranslation().y() << 
G4endl;
 
  174   fout << -voxelHalfWidthZ*nz+thePhantomTransform.NetTranslation().z() << 
" "  
  175        << voxelHalfWidthZ*nz+thePhantomTransform.NetTranslation().z() << 
G4endl;
 
  178     for( 
G4int iy = 0; iy < ny; iy++) {
 
  180       G4bool bPrevVoxelInside = 
true;
 
  181       G4bool b1VoxelFoundInside = 
false;
 
  182       G4int firstVoxel = -1;
 
  183       G4int lastVoxel = -1;
 
  184       for(
G4int ix = 0; ix < nx; ix++ ){
 
  186                    (-ny+iy*2+1)*voxelHalfWidthY, (-nz+
iz*2+1)*voxelHalfWidthZ);
 
  188         G4bool bVoxelIsInside = 
true;
 
  189         for( 
G4int ivx = -1; ivx <= 1; ivx+=2 ) {
 
  190           for( 
G4int ivy = -1; ivy <= 1; ivy+=2 ){
 
  191             for( 
G4int ivz = -1; ivz <= 1; ivz+=2 ) {
 
  192               G4ThreeVector voxelPoint = voxelCentre + ivx*voxelHalfWidthX*axisX +
 
  193         ivy*voxelHalfWidthY*axisY + ivz*voxelHalfWidthZ*axisZ;
 
  195                 bVoxelIsInside = 
false;
 
  200             if( !bVoxelIsInside ) 
break;
 
  202           if( !bVoxelIsInside ) 
break;
 
  205         G4int copyNo = ix + nx*iy + nxy*
iz;
 
  206         if( bVoxelIsInside ) {
 
  207           if( !bPrevVoxelInside ) {
 
  211                         "Volume cannot intersect phantom in discontiguous voxels, " 
  212             "please use other voxel");
 
  214           if( !b1VoxelFoundInside ) {
 
  216             b1VoxelFoundInside = 
true;
 
  225       fout << firstVoxel << 
" " << lastVoxel << 
G4endl;
 
  231     for( 
G4int iy = 0; iy < ny; iy++) {
 
  233       for(
G4int ix = 0; ix < nx; ix++ ){
 
  234         size_t copyNo = ix + ny*iy + nxy*
iz;
 
  247     for( 
G4int iy = 0; iy < ny; iy++) {
 
  249       for(
G4int ix = 0; ix < nx; ix++ ){
 
  250         size_t copyNo = ix + ny*iy + nxy*
iz;
 
  265   for( 
G4int ii = 0; ii < 6; ii++ ) params.erase( params.begin() ); 
 
  267   params.insert( params.begin(), 
":SOLID");
 
  268   params.insert( params.begin(), params[1] );
 
  288   std::vector<G4VPhysicalVolume*>::iterator cite;
 
  289   for( cite = pvs->begin(); cite != pvs->end(); cite++ ) {
 
  301   if( !paramreg && bMustExist ) 
 
  302     G4Exception(
"DicomIntersectVolume::GetPhantomParam",
 
  305                 " No G4PhantomParameterisation found ");
 
  316   std::vector<G4VPhysicalVolume*> vvolu;
 
  317   std::string::size_type ial = name.rfind(
":");
 
  320   if( ial != std::string::npos ) {
 
  321     std::string::size_type ial2 = name.rfind(
":",ial-1);
 
  322     if( ial2 != std::string::npos ) {
 
  323       G4Exception(
"DicomIntersectVolume::GetPhysicalVolumes",
 
  326                   G4String(
"Name corresponds to a touchable " + name).c_str());
 
  328       volname = name.substr( 0, ial );
 
  337   std::vector<G4VPhysicalVolume*>::iterator citepv;
 
  338   for( citepv = pvs->begin(); citepv != pvs->end(); citepv++ ) {
 
  339     if( volname == (*citepv)->GetName() 
 
  340         && ( (*citepv)->GetCopyNo() == volcopy || -1 == volcopy ) ){
 
  341       vvolu.push_back( *citepv );
 
  346   if( vvolu.size() == 0 ) {
 
  348       G4Exception(
" DicomIntersectVolume::GetPhysicalVolumes",
 
  351                   G4String(
"No physical volume found with name " + name).c_str());
 
  353       G4cerr << 
"!!WARNING: DicomIntersectVolume::GetPhysicalVolumes: no physical " <<
 
  354     "volume found with name " << name << 
G4endl;
 
  358   if( nVols != -1 && 
G4int(vvolu.size()) != nVols ) {
 
  359     G4Exception(
"DicomIntersectVolume::GetLogicalVolumes:",
 
  360                 "Wrong number of physical volumes found",
 
  362                 (
"Number of physical volumes " + 
 
  389                                        bool exists, 
G4int nVols )
 
  392   std::vector<G4LogicalVolume*> vvolu;
 
  393   G4int ial = name.rfind(
":");
 
  395     G4Exception(
"DicomIntersectVolume::GetLogicalVolumes",
 
  398                 G4String(
"Name corresponds to a touchable or physcal volume" + name).c_str());
 
  402   std::vector<G4LogicalVolume*>::iterator citelv;
 
  403   for( citelv = lvs->begin(); citelv != lvs->end(); citelv++ ) {
 
  404     if( name == (*citelv)->GetName() ) {
 
  405       vvolu.push_back( *citelv );
 
  410   if( vvolu.size() == 0 ) {
 
  412       G4Exception(
"DicomIntersectVolume::GetLogicalVolumes:",
"",
 
  415       G4Exception(
"DicomIntersectVolume::GetLogicalVolumes:",
"",
 
  416           JustWarning,(
"no  logical volume found with name " + name).c_str());
 
  420   if( nVols != -1 && 
G4int(vvolu.size()) != nVols ) {
 
  421     G4Exception(
"DicomIntersectVolume::GetLogicalVolumes:",
 
  422                 "Wrong number of logical volumes found",
 
  424                 (
"Number of logical volumes " +
 
  436   std::vector<G4String> wordlist;
 
  441   const char* cstr = stemp.c_str();
 
  442   int siz = stemp.length();
 
  445   bool lastIsBlank = 
false;
 
  446   bool lastIsQuote = 
false;
 
  447   for( ii = 0; ii < siz; ii++ ){
 
  448     if(cstr[ii] == 
'\"' ){
 
  451             (
"There cannot be two quotes together " + stemp).c_str() );
 
  453       if( nQuotes%2 == 1 ){
 
  455         wordlist.push_back( stemp.substr(istart,ii-istart) );
 
  464     } 
else if(cstr[ii] == 
' ' ){
 
  467       if( nQuotes%2 == 0 ){
 
  468         if( !lastIsBlank && !lastIsQuote ) {
 
  469           wordlist.push_back( stemp.substr(istart,ii-istart) );
 
  480         wordlist.push_back( stemp.substr(istart,ii-istart+1) );
 
  488   if( nQuotes%2 == 1 ) {
 
  490         (
"unbalanced quotes in line " + stemp).c_str() );
 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
 
std::vector< G4String > GetWordsInString(const G4String &stemp)
 
G4ThreeVector GetFrameTranslation() const 
 
G4VSolid * FindOrConstructG4Solid(const G4tgrSolid *vol)
 
CLHEP::Hep3Vector G4ThreeVector
 
CLHEP::HepRotation G4RotationMatrix
 
G4UIcmdWithAString * fUserVolumeCmd
 
G4double GetDensity() const 
 
static G4String ConvertToString(G4bool boolVal)
 
std::vector< G4LogicalVolume * > GetLogicalVolumes(const G4String &name, bool exists, G4int nVols)
 
size_t GetMaterialIndex(size_t nx, size_t ny, size_t nz) const 
 
size_t GetNoVoxelZ() const 
 
static G4PhysicalVolumeStore * GetInstance()
 
const G4RotationMatrix * GetFrameRotation() const 
 
G4VPVParameterisation * GetParameterisation() const 
 
virtual EInside Inside(const G4ThreeVector &p) const =0
 
virtual G4int GetRegularStructureId() const =0
 
void SetGuidance(const char *aGuidance)
 
std::vector< G4Material * > GetMaterials() const 
 
static G4double ConvertToDouble(const char *st)
 
static G4LogicalVolumeStore * GetInstance()
 
const G4String & GetCommandPath() const 
 
void AvailableForStates(G4ApplicationState s1)
 
void BuildG4Solid(std::vector< G4String > params)
 
G4double GetVoxelHalfY() const 
 
G4PhantomParameterisation * GetPhantomParam(G4bool bMustExist)
 
G4UIcmdWithAString * fG4VolumeCmd
 
static G4int ConvertToInt(const char *st)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
virtual void SetNewValue(G4UIcommand *command, G4String newValues)
 
G4Material * GetMaterial(size_t nx, size_t ny, size_t nz) const 
 
const G4String & GetCommandName() const 
 
void BuildUserSolid(std::vector< G4String > params)
 
size_t GetNoVoxelY() const 
 
G4double GetVoxelHalfX() const 
 
Definition of the DicomIntersectVolume class. 
 
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
 
G4double GetVoxelHalfZ() const 
 
std::vector< G4VPhysicalVolume * > GetPhysicalVolumes(const G4String &name, bool exists, G4int nVols)
 
size_t GetNoVoxelX() const 
 
static const G4double pos
 
G4bool IsPhantomVolume(G4VPhysicalVolume *pv)
 
G4GLOB_DLL std::ostream G4cerr