[Gate-users] about GateVImageActor:Construct
Alex Vergara Gil
alexvergaragil at gmail.com
Mon Jun 1 14:36:42 CEST 2015
Dear David
My solution doesn't mess with that mechanism, it only put extra
options for user to define image properties, if they are not specified
then the mechanism is used.
Details
if (!mHalfSizeIsSet){ //the user doesn't specify the size
if (mResolutionIsSet && mVoxelSizeIsSet){ //but specify resolution
and voxelsize
mHalfSize = KroneckerProduct(mResolution, mVoxelSize)/2; //compute
size as the dot product of resolution and voxelsize
}
else { // also it doesn't specify one of the resolution or
voxelsize variables
mHalfSize =
ComputeBoundingBox(mVolume->GetLogicalVolume()->GetSolid()); // so get
size from the volume the actor is attached to
}
mHalfSizeIsSet = true; // say that size is set
}
else { // the user specify the size
if (mResolutionIsSet && mVoxelSizeIsSet) { //but also the
resolution and the voxelsize so show an error
GateError("GateVImageActor -- Construct: Please give a combination
of two between" <<
" the size, the resolution and the voxelsize (not all) for the sensor");
}
}
if (!mResolutionIsSet && !mVoxelSizeIsSet) { // the size is defined
but neither the resolution nor the voxelsize, so use a default value
mResolution = G4ThreeVector(1.0, 1.0, 1.0);
mResolutionIsSet = true;
}
Regards
Alex
2015-06-01 5:20 GMT-04:00, David Sarrut <David.Sarrut at creatis.insa-lyon.fr>:
> Hello,
>
> exact. However, when the actor is attached to an image (having its hown
> size/resolution), there is also a mechanism that automatically set the
> actor with the exact same size/resolution than the image (the user can
> still specify what he want). Could you test if your proposal also work in
> this case ?
>
> thanks,
> David
>
> On Thu, May 28, 2015 at 6:26 PM, Alex Vergara Gil
> <alexvergaragil at gmail.com>
> wrote:
>
>> Dear Devs
>>
>> I am writting here because I have no access to gate-devel list.
>>
>> In the file GateVImageActor in the void GateVImageActor::Construct()
>> you expect for the user to declare the size of the output matrix
>> (let's call it S), and the the user has to choose between resolution
>> (R) OR voxelSize (VS), being S = R * VS. This is an annoying behavior
>> for the user because you may know VS and R, and then you must multiply
>> to put in the actor the Size. So why not using any possible
>> combination? Solution is easy to implement.
>>
>> Details
>>
>> void GateVImageActor::Construct()
>> ...
>> if (!mHalfSizeIsSet){
>> mHalfSize =
>> ComputeBoundingBox(mVolume->GetLogicalVolume()->GetSolid());
>> }
>> if (mResolutionIsSet && mVoxelSizeIsSet) {
>> GateError("GateVImageActor -- Construct: Please give the
>> resolution OR the voxelsize (not both) for the sensor");
>> }
>> if (!mResolutionIsSet && !mVoxelSizeIsSet) {
>> mResolution = G4ThreeVector(1.0, 1.0, 1.0);
>> mResolutionIsSet = true;
>> }
>>
>> Can be replaced by
>>
>> if (!mHalfSizeIsSet){
>> if (mResolutionIsSet && mVoxelSizeIsSet){
>> mHalfSize = KroneckerProduct(mResolution, mVoxelSize);
>> }
>> else {
>> mHalfSize =
>> ComputeBoundingBox(mVolume->GetLogicalVolume()->GetSolid());
>> }
>> }
>> else {
>> if (mResolutionIsSet && mVoxelSizeIsSet) {
>> GateError("GateVImageActor -- Construct: Please give a
>> combination
>> of two between" <<
>> " the size, the resolution and the
>> voxelsize (not all) for the sensor");
>> }
>> }
>> if (!mResolutionIsSet && !mVoxelSizeIsSet) {
>> mResolution = G4ThreeVector(1.0, 1.0, 1.0);
>> mResolutionIsSet = true;
>> }
>>
>> So now any combination of two of this variables lead to a valid Image
>> Actor
>>
>> Regards
>> Alex
>> _______________________________________________
>> Gate-users mailing list
>> Gate-users at lists.opengatecollaboration.org
>> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>>
>
>
>
> --
> David Sarrut, Phd
> Directeur de recherche CNRS
> CREATIS, UMR CNRS 5220, Inserm U 1044
> Centre de lutte contre le cancer Léon Bérard
> 28 rue Laënnec, 69373 Lyon cedex 08
> Tel : 04 78 78 51 51 / 06 74 72 05 42
> http://www.creatis.insa-lyon.fr/~dsarrut
> _________________________________
> "2 + 2 = 5, for extremely large values of 2"
> _________________________________
>
More information about the Gate-users
mailing list