Message: RE: Performance of homogeneous voxelised phantom Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None RE: Performance of homogeneous voxelised phantom 

Forum: Geometry
Re: None Performance of homogeneous voxelised phantom (Sven Lotze)
Re: None RE: Performance of homogeneous voxelised phantom (Makoto Asai)
Date: 09 Nov, 2007
From: Sven Lotze <sven>

I implemented the voxels as simple as it gets,
just as a first try. Maybe I should add that 
the simulation is *not* limited by memory use,
as I only have 30x30x15 voxels, leading to 2-3%
memory usage.

-------------------------------------------------------------------
The voxelised phantom:


   // Water volume
   G4Box* phantom_solid
      = new G4Box("phantom_solid",
                   phantom_half_x
                      / phantom_segments_xy,
                   phantom_half_y
                      / phantom_segments_xy,
                   phantom_half_z
                      / phantom_segments_z);

   for( size_t i=0; i<phantom_segments_xy; i++ )
   {
      for( size_t j=0; j<phantom_segments_xy; j++ )
      {
         for( size_t k=0; k<phantom_segments_z; k++ )
         {
            phantom_log[i][j][k]
               = new G4LogicalVolume(phantom_solid,
                                     Water,
                                     "phantom_log");
            phantom_phys[i][j][k]
               = new G4PVPlacement(0,
                                   G4ThreeVector( -phantom_half_x
                                                     + ( i+0.5 ) * 2*phantom_half_x
                                                                   /phantom_segments_xy,
                                                  -phantom_half_y
                                                     + ( j+0.5 ) * 2*phantom_half_y
                                                                   /phantom_segments_xy,
                                                   ( k+0.5 ) * 2*phantom_half_z
                                                               / phantom_segments_z ),
                                   phantom_log[i][j][k],
                                   "phantom_phys",
                                   treatmentRoom_log,
                                   false,
                                   i + j*phantom_segments_xy + k*(phantom_segments_xy*phantom_segments_xy) );
                                   //    ^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                   //       cells per row                    cells per layer
         }
      }
   }


--------------------------------------------------------------------
...followed by SetupDetectors:

   // Loop over x, y, and z voxel indices,
   // create an independent detector for each voxel
   for( size_t i=0; i<phantom_segments_xy; i++ )
   {
      for( size_t j=0; j<phantom_segments_xy; j++ )
      {
         for( size_t k=0; k<phantom_segments_z; k++ )
         {
            // Assemble detector pixel name:
            detVoxName = "PhantomX";
            sprintf( str,"%d", i );
            detVoxName += str;

            detVoxName += "Y";
            sprintf( str,"%d", j );
            detVoxName += str;

            detVoxName += "Z";
            sprintf( str,"%d", k );
            detVoxName += str;

            // Each pixel (spatial resolution) is an independent detector
            G4MultiFunctionalDetector* detector
               = new G4MultiFunctionalDetector( detVoxName );
            // Volume Scorer which scores energy deposited in voxel volume:
            G4PSEnergyDeposit* scorer
               = new G4PSEnergyDeposit( "EDeposit" );
            detector->RegisterPrimitive( scorer );

            G4SDManager::GetSDMpointer()->AddNewDetector( detector );
            phantom_log[i][j][k]->SetSensitiveDetector( detector );
        }
      }
   }
}

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "RE: Performance of homogeneous voxelised phantom"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]