some tips for geometries of medical applications

12
Some tips for Some tips for geometries of geometries of medical medical applications applications Makoto Asai (SLAC) Makoto Asai (SLAC)

Upload: linore

Post on 14-Jan-2016

26 views

Category:

Documents


0 download

DESCRIPTION

Some tips for geometries of medical applications. Makoto Asai (SLAC). Most efficient way of simulating DICOM-like 3D voxels with material parameterization. Options you can take - 1. There is no silver bullet. You can try some/all of these options combined. Huge number of cells - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Some tips for geometries of medical applications

Some tips for Some tips for geometries of medical geometries of medical

applicationsapplications

Makoto Asai (SLAC)Makoto Asai (SLAC)

Page 2: Some tips for geometries of medical applications

Most efficient way of simulating Most efficient way of simulating DICOM-like 3D voxels with DICOM-like 3D voxels with material parameterizationmaterial parameterization

Page 3: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 33

Options you can take - 1Options you can take - 1 There is no silver bullet. You can try some/all of these options combined.There is no silver bullet. You can try some/all of these options combined. Huge number of cellsHuge number of cells

If 3D parameterized volume with material parameterization is used,If 3D parameterized volume with material parameterization is used, Compact memory size but slow in case of 1D optimizationCompact memory size but slow in case of 1D optimization Fast but huge memory size in case of 3D optimizationFast but huge memory size in case of 3D optimization

Use replica for the first and second axes slices and 1-dimensional Use replica for the first and second axes slices and 1-dimensional parameterization for the third axis. Use G4NestedParameterisation parameterization for the third axis. Use G4NestedParameterisation to parameterize the material.to parameterize the material.

Material mapMaterial map Though number of materials appear is quite limited, each cell must Though number of materials appear is quite limited, each cell must

at least have a pointer to a material. I.e. you have to have a huge at least have a pointer to a material. I.e. you have to have a huge material map which has entries of the number of cells.material map which has entries of the number of cells.

Split your whole voxel geometry into reasonable number of regions, Split your whole voxel geometry into reasonable number of regions, and assign a dedicated stack to each region. For example 5*5*5 = and assign a dedicated stack to each region. For example 5*5*5 = 125 regions.125 regions.

Load material map (from your file on the disk) only for one region. If Load material map (from your file on the disk) only for one region. If a track reaches to the boundary of the region you are currently a track reaches to the boundary of the region you are currently simulating, suspend the track.simulating, suspend the track.

Simulate all the tracks in one region. Once a region becomes empty, Simulate all the tracks in one region. Once a region becomes empty, load material map for another region and simulate all tracks in that load material map for another region and simulate all tracks in that region.region.

Note that some tracks may come back to a region you have already Note that some tracks may come back to a region you have already simulated.simulated.

Page 4: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 44

Options you can take - 2Options you can take - 2 Event biasingEvent biasing

In particular, geometrical importance biasing, and secondary In particular, geometrical importance biasing, and secondary particle splitting must be good options to take.particle splitting must be good options to take.

You must validate results of your biasing options with full You must validate results of your biasing options with full simulation.simulation.

Shower parameterizationShower parameterization In stead of having a full EM shower, you may want to consider the In stead of having a full EM shower, you may want to consider the

shower parameterization in particular for the core part of the shower parameterization in particular for the core part of the shower.shower.

Dedicated navigatorDedicated navigator Given the geometry is perfectly regular, you may want to consider Given the geometry is perfectly regular, you may want to consider

implementing a dedicated navigator that is absolutely simple-implementing a dedicated navigator that is absolutely simple-minded to handle just regular pattern of boxes of same size, thus minded to handle just regular pattern of boxes of same size, thus quite fast.quite fast.

Your navigator should be set to G4Transportation process.Your navigator should be set to G4Transportation process. ParallelizationParallelization

Allocate good number of CPUs…Allocate good number of CPUs… Details on Takashi’s talk.Details on Takashi’s talk.

Page 5: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 55

Nested parameterizationNested parameterization Suppose your geometry has three-dimensional regular reputation of

same shape and size of volumes without gap between volumes. And material of such volumes are changing according to the position.

E.g. voxels made by CT Scan data (DICOM) Instead of direct three-dimensional parameterized volume,

use replicas for the first and second axes sequentially, and then use one-dimensional parameterization along the third axis.

It requires much less memory for geometry optimization and gives much faster navigation for ultra-large number of voxels.

Page 6: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 66

Nested parameterizationNested parameterization

0

1

2

01

20 1 2 3

Given geometry is defined as two sequential replicas and then one-dimensional parameterization,

Material of a voxel must be parameterized not only by the copy number of the voxel, but also by the copy numbers of ancestors.

Material is indexed by three indices. G4VNestedParameterisation is a special parameterization class

derived from G4VPVParameterisation base class. ComputeMaterial() method of G4VNestedParameterisation has a

touchable object of the parent physical volume, in addition to the copy number of the voxel.

Index of first axis = theTouchable->GetCopyNumber(1); Index of second axis = theTouchable->GetCopyNumber(0); Index of third axis = copy number

Page 7: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 77

G4VNestedParameterisationG4VNestedParameterisation G4VNestedParameterisation is derived from G4VNestedParameterisation is derived from

G4VPVParameterization.G4VPVParameterization. G4VNestedParameterisation class has three G4VNestedParameterisation class has three pure virtualpure virtual methods methods

you have to implement, you have to implement, in addition to ComputeTransformation() method, which is in addition to ComputeTransformation() method, which is

mandatory for all G4VPVParameterization classes.mandatory for all G4VPVParameterization classes.

virtual G4Material* virtual G4Material* ComputeMaterialComputeMaterial(G4VPhysicalVolume (G4VPhysicalVolume *currentVol,*currentVol,const G4int repNo, const G4VTouchable *parentTouch=0)=0;const G4int repNo, const G4VTouchable *parentTouch=0)=0;

Return a material pointer w.r.t. copy numbers of itself and Return a material pointer w.r.t. copy numbers of itself and ancestors.ancestors.

Must cope with parentTouch=0 for navigator's sake. Typically, Must cope with parentTouch=0 for navigator's sake. Typically, return a default material if parentTouch=0.return a default material if parentTouch=0.

virtual G4int virtual G4int GetNumberOfMaterialsGetNumberOfMaterials() const=0;() const=0; Return total number of materials which may appear as the return Return total number of materials which may appear as the return

value of ComputeMaterial() method.value of ComputeMaterial() method.

virtual G4Material* virtual G4Material* GetMaterialGetMaterial(G4int idx) const=0;(G4int idx) const=0; Return idx-th material.Return idx-th material. ““idx” is not a copy number. idx = [0, nMaterial-1]idx” is not a copy number. idx = [0, nMaterial-1]

Page 8: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 88

G4VNestedParameterisationG4VNestedParameterisation G4VNestedParameterisation is a kind of G4VPVParameterization.G4VNestedParameterisation is a kind of G4VPVParameterization.

It can be used as an argument of G4PVParameterised.It can be used as an argument of G4PVParameterised. All other arguments of G4PVParameterised are unaffected.All other arguments of G4PVParameterised are unaffected.

Nested parameterization of placement volume is Nested parameterization of placement volume is notnot supported. supported. All levels used as indices of material must be All levels used as indices of material must be repeated volumerepeated volume. .

There cannot be a level of placement volume in between.There cannot be a level of placement volume in between.

If you are interested in, you can download a sample programIf you are interested in, you can download a sample program

http://www.slac.stanford.edu/~asai/Nested.tar.gzhttp://www.slac.stanford.edu/~asai/Nested.tar.gz It is still a beta-version. It will be replaced with current It is still a beta-version. It will be replaced with current

examples/extended/runAndEvent/RE02 at 9.0 release.examples/extended/runAndEvent/RE02 at 9.0 release. In case you utilize this sample program and write a paper before the In case you utilize this sample program and write a paper before the

official release of this example, please acknowledge the authors official release of this example, please acknowledge the authors explicitly.explicitly.

Makoto Asai (SLAC)Makoto Asai (SLAC) Tsukasa Aso (Toyama N.C.M.T.)Tsukasa Aso (Toyama N.C.M.T.) Akinori Kimura (Ashikaga I.T.)Akinori Kimura (Ashikaga I.T.)

Page 9: Some tips for geometries of medical applications

Moving objectsMoving objects

Page 10: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 1010

Moving objectsMoving objects In some applications, it is essential to simulate the movement of In some applications, it is essential to simulate the movement of

some volumes.some volumes.

E.g. particle therapy simulationE.g. particle therapy simulation

Geant4 can deal with moving volumeGeant4 can deal with moving volume

In case speed of the moving volume is slow enough compared to In case speed of the moving volume is slow enough compared to

speed of elementary particles, so that you can assume the speed of elementary particles, so that you can assume the

position of moving volume is still within one event.position of moving volume is still within one event.

Two tips to simulate moving objects :Two tips to simulate moving objects :

1.1. Use parameterized volume to represent the moving volume.Use parameterized volume to represent the moving volume.

2.2. Do not optimize (voxelize) the mother volume of the moving Do not optimize (voxelize) the mother volume of the moving

volume(s).volume(s).

Page 11: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 1111

Moving objects - tip 1Moving objects - tip 1 Use parameterized volume to represent the moving volume.Use parameterized volume to represent the moving volume.

Use event number as a time stamp and calculate position/rotation Use event number as a time stamp and calculate position/rotation of the volume as a function of event number.of the volume as a function of event number.

void MyMovingVolumeParameterisation::void MyMovingVolumeParameterisation::ComputeTransformationComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const(const G4int copyNo, G4VPhysicalVolume *physVol) const{{ static G4RotationMatrix rMat;static G4RotationMatrix rMat; G4int eID = 0;G4int eID = 0; const G4Event* evt = G4RunManager::GetRunManager()-const G4Event* evt = G4RunManager::GetRunManager()-

>GetCurrentEvent();>GetCurrentEvent(); if(evt) eID = evt->GetEventID();if(evt) eID = evt->GetEventID(); G4double t = 0.1*s*eID;G4double t = 0.1*s*eID; G4double r = rotSpeed*t;G4double r = rotSpeed*t; G4double z = velocity*t+orig;G4double z = velocity*t+orig; while(z>0.*m) {z-=8.*m;}while(z>0.*m) {z-=8.*m;} rMat.set(HepRotationX(-r));rMat.set(HepRotationX(-r)); physVol->SetTranslation(G4ThreeVector(0.,0.,z));physVol->SetTranslation(G4ThreeVector(0.,0.,z)); physVol->SetRotation(&rMat0);physVol->SetRotation(&rMat0);}}

Null pointer must be protected.This method is also invoked while

geometry is being closed atthe beginning of run, i.e.

event loop has not yet began.

You are responsible not to make the moving volume get out of

(protrude from) the mother volume.

Here, event number is convertedto time.

(0.1 sec/event)

Position and rotationare set as the function

of event number.

Page 12: Some tips for geometries of medical applications

Geometry IV - M.Asai (SLAC)Geometry IV - M.Asai (SLAC) 1212

Moving objects - tip 2Moving objects - tip 2 Do not optimize (voxelize) the mother volume of the moving volume(s).Do not optimize (voxelize) the mother volume of the moving volume(s).

If moving volume gets out of the original optimized voxel, the If moving volume gets out of the original optimized voxel, the navigator gets lost.navigator gets lost.

motherLogical -> motherLogical -> SetSmartlessSetSmartless( ( number_of_daughters number_of_daughters ););

With this method invocation, the one-and-only optimized voxel has With this method invocation, the one-and-only optimized voxel has all daughter volumes.all daughter volumes.

For the best performance, use hierarchal geometry so that each For the best performance, use hierarchal geometry so that each mother volume has least number of daughters.mother volume has least number of daughters.

If you are interested in, you can download a sample programIf you are interested in, you can download a sample program

http://www.slac.stanford.edu/~asai/Rot.tar.gzhttp://www.slac.stanford.edu/~asai/Rot.tar.gz