[Gate-users] Using parameters for mac files

BAKER, Mark (THE CLATTERBRIDGE CANCER CENTRE NHS FOUNDATION TRUST) mark.baker23 at nhs.net
Mon Mar 21 11:03:06 CET 2022


Hi all

Well it turns out that I was a little premature in my celebration. Whilst my script works perfectly if I manually put in the values I want but if the values is in the form of a $variable then I alias errors. I’ve tried various combinations of “” `` and ‘’ to no avail unfortunately. In addition to this email chain, I also found this github post https://github.com/OpenGATE/Gate/issues/69 and a similar mailbase post (http://lists.opengatecollaboration.org/pipermail/gate-users/2015-March/008227.html) about the issue but the solution didn’t work me either. I’m on VGate9.0 if that makes a difference, as both of those posts are possibly a version or two earlier based on their date.

I know little about bash scripts, but I believe the variable is being stored correctly as it works with echo and displays what I expect.

Does anyone have any suggestions or alternatives that I can explore?

Thank you very much

Mark Baker
Principal Clinical Scientist (Interim)
Imaging Physics (Ionising)
The Clatterbridge Cancer Centre NHS Foundation Trust
(he, him)

CCCW Tel:  0151 556 5030
CCCL Tel: 0151 318 8438
Email: mark.baker23 at nhs.net<mailto:mark.baker23 at nhs.net>
Microsoft Teams (click here)<https://teams.microsoft.com/l/chat/0/0?users=mark.baker23@nhs.net>

From: Gate-users <gate-users-bounces at lists.opengatecollaboration.org> On Behalf Of BAKER, Mark (THE CLATTERBRIDGE CANCER CENTRE NHS FOUNDATION TRUST)
Sent: 17 March 2022 14:03
To: Helge Pettersen <helge.e.s.pettersen at gmail.com>; Schneider Tim <Tim.Schneider at curie.fr>
Cc: gate-users at lists.opengatecollaboration.org
Subject: Re: [Gate-users] [BULK ?] Using parameters for mac files

Thank you very much Tim and Helge, that is working now. I won’t tell you how embarrassingly long I spent trying to fix what was effectively just the wrong order.

I have a few other small bugs to iron out, such as it thinks the extension is missing from the PET data etc. now, but it is at least triggering Gate to open.

Thank you

Mark Baker
Principal Clinical Scientist (Interim)
Imaging Physics (Ionising)
The Clatterbridge Cancer Centre NHS Foundation Trust
(he, him)

CCCW Tel:  0151 556 5030
CCCL Tel: 0151 318 8438
Email: mark.baker23 at nhs.net<mailto:mark.baker23 at nhs.net>
Microsoft Teams (click here)<https://teams.microsoft.com/l/chat/0/0?users=mark.baker23@nhs.net>

From: Helge Pettersen <helge.e.s.pettersen at gmail.com<mailto:helge.e.s.pettersen at gmail.com>>
Sent: 17 March 2022 13:37
To: Schneider Tim <Tim.Schneider at curie.fr<mailto:Tim.Schneider at curie.fr>>
Cc: BAKER, Mark (THE CLATTERBRIDGE CANCER CENTRE NHS FOUNDATION TRUST) <mark.baker23 at nhs.net<mailto:mark.baker23 at nhs.net>>; gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>
Subject: Re: [Gate-users] [BULK ?] Using parameters for mac files

Hi,

I don't know if this is the issue, but I usually have to escape the parameter list when I use bash $variables. See example below:

Gate -a "'[phantom,$phantom] [spotx,$x]
[spoty,$y] [theta,$theta] [axisx,$axis_x] [axisy,$axis_y]
[rotation,90]'" Main_phantom.mac



Good luck,

Helge Egil Seime Pettersen, PhD
Particle Therapy / Imaging / Proton CT
Department of Oncology and Medical Physics
Haukeland University Hospital
Bergen, Norway


On Thu, Mar 17, 2022 at 2:15 PM Schneider Tim <Tim.Schneider at curie.fr<mailto:Tim.Schneider at curie.fr>> wrote:
Hi Mark,

When I run macros with parameters, I call them like this:

Gate -a [param,value] mac/macro.mac

Not sure if your way of doing it is correct as well, but the above always worked for me.

Cheers,
Tim

Am 17/03/2022 um 13:11 schrieb BAKER, Mark (THE CLATTERBRIDGE CANCER CENTRE NHS FOUNDATION TRUST) <mark.baker23 at nhs.net<mailto:mark.baker23 at nhs.net>>:

Hi all

I am trying to run some parameters into my Gate simulation, but it doesn’t seem to be working and Gate sticks at the PreInit stage (although the CPU does ramp up to 100%). I am running multiple instances of Gate (up to 8 simultanouely), so it is laborious to go into each of the macs every time I want to change a parameter, so I was hoping this would help. My project is hoping to calculate dose distributions from PET scans using CT scans as the geometry. Previously it was working fine until I tried to add the parameters.

The relevant parts of my code are below (there is obviously a lot more so I’ve attached the files also in case anyone wants to look deeper, some bits commented out during the debugging)

In the main1.mac, I have changed the geometry to
/gate/world/daughters/name patientCT
/gate/world/daughters/insert ImageNestedParametrisedVolume
/gate/patientCT/geometry/setImage {CTData}

The main1.mac calls sourceF18.mac as its source, which contains the link to the PET data. The relevant part is
/gate/source/addSource patientPET voxel
/gate/source/patientPET/imageReader/readFile {PETData}

I also change the number of primaries on the fly, so I set that to the following in main1.mac
/gate/application/setTotalNumberOfPrimaries {NoOfPrimaries}

I’ve a got a script to run the multiple instances of Gate, alongside a lot of housework for moving files and merging them etc. I have checked the input to the parameters, and as far as I can tell, they are fine.

I call Gate using the following
Gate mac/main1.mac [CTData,$CTDataFile] [NoOfPrimaries,$NumberPrimaries] [PETData,$PTDataFile] &

where the user could select the following information, for example,
$CTDataFile is data/dcm/CT/br38f.mha
$PTDataFile is data/dcm/PT/brainmaskPET.mha
$NumberPrimaries is 1000

If I go back to my main1.mac etc. and manually change the parameters to the data above and change my run.sh script to Gate mac/main1.mac &  it works perfectly, so presumably I am doing something wrong with passing the parameters through.

I’d appreciate it if anyone had any thoughts on this?

Thank you

Mark Baker
Principal Clinical Scientist (Interim)
Imaging Physics (Ionising)
The Clatterbridge Cancer Centre NHS Foundation Trust
(he, him)

CCCW Tel:  0151 556 5030
CCCL Tel: 0151 318 8438
Email: mark.baker23 at nhs.net<mailto:mark.baker23 at nhs.net>
Microsoft Teams (click here)<https://teams.microsoft.com/l/chat/0/0?users=mark.baker23@nhs.net>

Honorary Lecturer, Dept. of Physics
University of Liverpool





************************************************************************************** ******************************

This message may contain confidential information. If you are not the intended recipient please:
i) inform the sender that you have received the message in error before deleting it; and
ii) do not disclose, copy or distribute information in this e-mail or take any action in relation to its content (to do so is strictly prohibited and may be unlawful).
Thank you for your co-operation.

NHSmail is the secure email, collaboration and directory service available for all NHS staff in England. NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and other accredited email services.

For more information and to find out how you can switch visit Joining NHSmail – NHSmail Support<https://support.nhs.net/article-categories/joining-nhsmail/>
_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org<mailto:Gate-users at lists.opengatecollaboration.org>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org<mailto:Gate-users at lists.opengatecollaboration.org>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users



This message originated from outside of NHSmail. Please do not click links or open attachments unless you recognise the sender and know the content is safe.



************************************************************************************** ******************************

This message may contain confidential information. If you are not the intended recipient please:
i) inform the sender that you have received the message in error before deleting it; and
ii) do not disclose, copy or distribute information in this e-mail or take any action in relation to its content (to do so is strictly prohibited and may be unlawful).
Thank you for your co-operation.

NHSmail is the secure email, collaboration and directory service available for all NHS staff in England. NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and other accredited email services.

For more information and to find out how you can switch visit Joining NHSmail – NHSmail Support<https://support.nhs.net/article-categories/joining-nhsmail/>



This message originated from outside of NHSmail. Please do not click links or open attachments unless you recognise the sender and know the content is safe.



************************************************************************************** ******************************

This message may contain confidential information. If you are not the intended recipient please:
i) inform the sender that you have received the message in error before deleting it; and
ii) do not disclose, copy or distribute information in this e-mail or take any action in relation to its content (to do so is strictly prohibited and may be unlawful).
Thank you for your co-operation.

NHSmail is the secure email, collaboration and directory service available for all NHS staff in England. NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and other accredited email services.

For more information and to find out how you can switch visit Joining NHSmail – NHSmail Support<https://support.nhs.net/article-categories/joining-nhsmail/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220321/adf05f13/attachment-0001.html>


More information about the Gate-users mailing list