[Simnibs-discuss] Fwd: Re: ROI analysis

Guilherme B Saturnino guilhermebs at drcmr.dk
Tue Dec 17 10:50:06 CET 2019




-------- Forwarded Message --------
Subject: 	Re: ROI analysis
Date: 	Tue, 17 Dec 2019 09:59:36 +0100
From: 	Guilherme B Saturnino <guilhermebs at drcmr.dk>
To: 	Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>



Thank you!

One more thing: If you opt for transforming simulation to nifti images, 
you also need to be carefull only to consider gray matter voxels in the 
analysis. For that, you can use the file or the masks in the 
m2m_subID/SUBID_final_contr.nii.gz or generate tissue masks with the 
"msh2nii" command (try "msh2nii --help")


Best Regards,

Guilherme

On 17/12/2019 09.51, Tulika Nandi wrote:
>
> Hi Guilherme,
>
> Thank you for the guidance – I’ll try it out over the next few days.
>
> Yes, please feel free to share this.
>
> Kind regards,
>
> Tulika
>
> *From: *Guilherme B Saturnino <guilhermebs at drcmr.dk>
> *Date: *Tuesday, 17 December 2019 at 08:42
> *To: *Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
> *Subject: *Re: ROI analysis
>
> Dear Tulika,
>
> We are setting up a public mailing list for SimNIBS, and I think this 
> conversation could be very useful for other people as well. Do you 
> mind if I post it there?
>
> Best Regards,
>
> Guilherme
>
> On 17/12/2019 09.41, Guilherme B Saturnino wrote:
>
>     Dear Tulika,
>
>     No problems, I'm happy to help.
>
>     1- Depends. if it the head model was created with "headreco", the
>     space is preserved so you can just use world coordinates from the
>     original scan. However, if the model was created with "mri2mesh",
>     changing to MNI space is probably a good idea as this pipeline
>     changes the space of the images.
>
>     2- Sure. Just use a L-infinity norm instead of an L-2 norm.
>     roi = np.linalg.norm(elm_centers - ernie_coords, axis=1,
>     *ord=np.inf*) < r
>
>     Alternatively, you can transform simulation results to NifTi files
>     and do the analysis there. There are several ways to do this in
>     SimNIBS, such as setting Edit->Options->Interpolate to a nifti
>     volume in the GUI, setting map_to_vol=True in scripts or running
>     "msh2nii" on a ".msh" file.
>
>     Best Regards,
>
>     Guilherme
>
>     On 16/12/2019 17.43, Tulika Nandi wrote:
>
>         Hi Guilherme,
>
>         Sorry to bother you again – I have one more question.
>
>         We have a voxel (in nifti format) in which MRS data was
>         obtained. We want to use this as an roi for estimating the
>         average current –
>
>          1. This voxel is already in subject space. Is it necessary to
>             move it to MNI space and then get the center for doing the
>             roi analysis?
>          2. Can the roi be changed from a sphere to a cube?
>
>         Kind regards,
>
>         Tulika
>
>         *From: *Guilherme B Saturnino <guilhermebs at drcmr.dk>
>         <mailto:guilhermebs at drcmr.dk>
>         *Date: *Tuesday, 3 December 2019 at 15:36
>         *To: *Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>         <mailto:tulika.nandi at ndcn.ox.ac.uk>, Oula Puonti
>         <oupu at elektro.dtu.dk> <mailto:oupu at elektro.dtu.dk>
>         *Subject: *Re: ROI analysis
>
>         Hi Tulika,
>
>         /The gmsh visualization popped up in a few seconds but after
>         that it took a while to run. I’ll try it again./
>
>         It waits for the Gmsh window to be closed before continuing,
>         so it might be just that?
>
>         /I would eventually like to run this on a cluster (because the
>         m2m folders are stored there), but save the roi mesh and
>         output (mean E field) to look at later. Could you tell me how
>         to do that?/
>
>         Sure,
>
>         to save the roi mesh, just replace line 39 with
>
>         gray_matter.write('gm_roi.msh')
>
>         As to how to save the "mean_norm_E" in a file, I would
>         probably append values to a python list and then write it out
>         using for example
>
>         numpy save
>         <https://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html#numpy.savetxt>txt
>         <https://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html#numpy.savetxt>
>         (numpy is included with SimNIBS), or for more flexibility
>         create a pandas DataFrame (you can install pandas with
>         simnibs_python -m pip install pandas).
>
>         Best,
>
>         Guilherme
>
>         On 03/12/2019 16.11, Tulika Nandi wrote:
>
>             Hi Guilherme,
>
>             The gmsh visualization popped up in a few seconds but
>             after that it took a while to run. I’ll try it again.
>
>             I would eventually like to run this on a cluster (because
>             the m2m folders are stored there), but save the roi mesh
>             and output (mean E field) to look at later. Could you tell
>             me how to do that?
>
>             Thanks!
>
>             Tulika
>
>             *From: *Guilherme B Saturnino <guilhermebs at drcmr.dk>
>             <mailto:guilhermebs at drcmr.dk>
>             *Date: *Tuesday, 3 December 2019 at 15:07
>             *To: *Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>             <mailto:tulika.nandi at ndcn.ox.ac.uk>, Oula Puonti
>             <oupu at dtu.dk> <mailto:oupu at dtu.dk>
>             *Subject: *Re: ROI analysis
>
>             Hi Tulika,
>
>             Thanks.
>
>             The code looks fine, but it's weird it takes so long. In
>             every machine I've tried it runs in a few seconds.
>
>             Maybe it gets stuck in the plotting (line 39)?
>
>             Best Regards,
>
>             Guilherme
>
>             On 03/12/2019 15.52, Tulika Nandi wrote:
>
>                 Thanks Oula!
>
>                 Guilherme, please see the attached script – it is
>                 essentially the script that you provide with just the
>                 filenames and paths changed. It took about a couple
>                 hours to run – which is not a problem, I just want to
>                 make sure I’m not doing something wrong
>
>                 Kind regards,
>
>                 Tulika
>
>                 *From: *Oula Puonti <oupu at dtu.dk> <mailto:oupu at dtu.dk>
>                 *Date: *Tuesday, 3 December 2019 at 14:49
>                 *To: *Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>                 <mailto:tulika.nandi at ndcn.ox.ac.uk>
>                 *Cc: *Guilherme B Saturnino <guilhermebs at drcmr.dk>
>                 <mailto:guilhermebs at drcmr.dk>
>                 *Subject: *Re: ROI analysis
>
>                 Hi Tulika,
>
>                 Was this a e-field ROI analysis? Can you maybe send me
>                 the script you used?
>
>                 I'm including Guilherme in this script as he's more
>                 familiar with the e-field analysis part.
>
>                 Best,
>
>                 Oula
>
>                 ------------------------------------------------------------------------
>
>                 *From:*Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>                 <mailto:tulika.nandi at ndcn.ox.ac.uk>
>                 *Sent:* Tuesday, December 3, 2019 3:44:29 PM
>                 *To:* Oula Puonti
>                 *Subject:* Re: ROI analysis
>
>                 I was trying it for a single subject and it took about
>                 a couple hours.
>
>                 Kind regards,
>
>                 Tulika
>
>                 *From: *Oula Puonti <oupu at dtu.dk> <mailto:oupu at dtu.dk>
>                 *Date: *Tuesday, 3 December 2019 at 14:43
>                 *To: *Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>                 <mailto:tulika.nandi at ndcn.ox.ac.uk>
>                 *Subject: *Re: ROI analysis
>
>                 Hi Tulika,
>
>                 I wouldn't expect that unless the mesh is huge.
>
>                 Is this a single subject only or over the a group?
>
>                 Best,
>
>                 Oula
>
>                 ------------------------------------------------------------------------
>
>                 *From:*Tulika Nandi <tulika.nandi at ndcn.ox.ac.uk>
>                 <mailto:tulika.nandi at ndcn.ox.ac.uk>
>                 *Sent:* Tuesday, December 3, 2019 3:41:02 PM
>                 *To:* Oula Puonti
>                 *Subject:* ROI analysis
>
>                 Hi Oula,
>
>                 Quick question about the ROI analysis code – is it
>                 expected to take more than 2 hrs to run?
>
>                 Kind regards,
>
>                 Tulika
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20191217/316d44c0/attachment-0001.html>


More information about the Simnibs-discuss mailing list