From tyarkoni at gmail.com Fri Oct 2 19:02:27 2020 From: tyarkoni at gmail.com (Tal Yarkoni) Date: Fri, 2 Oct 2020 18:02:27 -0500 Subject: [Neuroimaging] Opportunities for experienced modellers to join a collaborative NSF-funded open-source software development project Message-ID: An NSF-funded multi-investigator collaboration is seeking individuals to help develop a standardized format for exchanging computational models among neuroscience, cognitive science and machine learning. The project was recently funded by NSF?s Convergence Accelerator Program, and involves Princeton Neuroscience Institute; The University of Texas at Austin; University College London; Yale Computer Science Department; and Intel Labs, in collaboration with members of the broader community. We seek individuals who have considerable experience in computational modeling in cognitive science, neuroscience, and/or machine learning. Preference is for individuals with a PhD in a relevant discipline (Neuroscience, Cognitive Psychology and/or Computer Science), but others with sufficient demonstrated experience will be considered. Experience in Python is necessary, and experience in one or more existing modeling environments (e.g., NEURON, The Virtual Brain, NeuroML, Emergent, Nengo, ACT-R, PyTorch and/or TensorFlow) is preferred. Involvement can be remote. Interested individuals should contact Jonathan Cohen (jdc at princeton.edu), Padraig Gleeson (p.gleeson at ucl.ac.uk), or Tal Yarkoni (tyarkoni at utexas.edu). Best, Tal -------------- next part -------------- An HTML attachment was scrubbed... URL: From d.soto at bcbl.eu Tue Oct 13 13:03:16 2020 From: d.soto at bcbl.eu (David Soto) Date: Tue, 13 Oct 2020 19:03:16 +0200 (CEST) Subject: [Neuroimaging] dicom to nifti Message-ID: <1498627478.1481437.1602608596304.JavaMail.zimbra@bcbl.eu> Hi, I am trying to convert single dicom files to a nifti file for a real time fMRI analysis the code looks like this ___ from nibabel.nicom import dicomreaders import pydicom dataset = pydicom.dcmread(dcm[0]) pepe = dicomreaders.mosaic_to_nii(dataset) pepe_nii = load_img(pepe) # loading nii with nibabel ____ i tried this a couple of days on our Siemens Prisma and it worked fine using a phantom today using the same scanner and phantom sequence it gives an error DicomReadError: data does not appear to be in mosaic format could you help please? cheers David -------------- next part -------------- An HTML attachment was scrubbed... URL: From d.soto at bcbl.eu Tue Oct 13 13:19:15 2020 From: d.soto at bcbl.eu (David Soto) Date: Tue, 13 Oct 2020 19:19:15 +0200 (CEST) Subject: [Neuroimaging] dicom to nifti In-Reply-To: <1498627478.1481437.1602608596304.JavaMail.zimbra@bcbl.eu> References: <1498627478.1481437.1602608596304.JavaMail.zimbra@bcbl.eu> Message-ID: <1793471023.1481760.1602609555557.JavaMail.zimbra@bcbl.eu> I figure this out, sorry my fault, I was reading the dicoms from the localiser :( thanks for the support and amazing software! cheers david > From: "David Soto" > To: "neuroimaging" > Sent: Tuesday, October 13, 2020 7:03:16 PM > Subject: [Neuroimaging] dicom to nifti > Hi, > I am trying to convert single dicom files to a nifti file for a real time fMRI > analysis > the code looks like this > ___ > from nibabel.nicom import dicomreaders > import pydicom > dataset = pydicom.dcmread(dcm[0]) > pepe = dicomreaders.mosaic_to_nii(dataset) > pepe_nii = load_img(pepe) # loading nii with nibabel > ____ > i tried this a couple of days on our Siemens Prisma and it worked fine using a > phantom > today using the same scanner and phantom sequence it gives an error > DicomReadError: data does not appear to be in mosaic format > could you help please? > cheers > David > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging -------------- next part -------------- An HTML attachment was scrubbed... URL: From outlook_E1019EAE083A5183 at outlook.com Sun Oct 18 04:53:25 2020 From: outlook_E1019EAE083A5183 at outlook.com (=?gb2312?B?wfUg1f4=?=) Date: Sun, 18 Oct 2020 08:53:25 +0000 Subject: [Neuroimaging] problems about pysurfer Message-ID: Hi, It is my forst time using pysurfer.While I use Windows10, I have no idea if this is gonna make some effects on the usage. When I run the first example, plot_basics.pyp, This error occurred to me ?? raise ValueError('The subjects directory has to be specified ' ValueError: The subjects directory has to be specified using the subjects_dir parameter or the SUBJECTS_DIR environment variable. ?? It seems that I should specify the subjects_dir while I don?t know how to do it. Or is it because I?m using windows? PS. Does the figure plotted by this package rorated by the mouse? I want to combine the fMRI images into a brain template, like brainstorm does. Do I chose the right pakage? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vivekatcube at gmail.com Sun Oct 18 13:48:46 2020 From: vivekatcube at gmail.com (Vivek Sharma) Date: Sun, 18 Oct 2020 23:18:46 +0530 Subject: [Neuroimaging] problems about pysurfer In-Reply-To: References: Message-ID: Hi, I guess you need to define the path for the subject directory which is typically what you generate using freesurfer. I'm not sure if freesurfer works with the windows, in that case either you can shift to linux or create a linux virtual environment where you can install freesurfer and generate the required files. On Sun, Oct 18, 2020 at 9:10 PM ? ? wrote: > Hi, It is my forst time using pysurfer.While I use Windows10, I have no > idea if this is gonna make some effects on the usage. When I run the first > example, *plot_basics.pyp, *This error occurred to me > > > > *?? **raise ValueError('The subjects directory has to be specified '* > > *ValueError: The subjects directory has to be specified using the > subjects_dir parameter or the SUBJECTS_DIR environment variable.* *??* > > > > It seems that I should specify the subjects_dir while I don?t know how to > do it. Or is it because I?m using windows? > > > > PS. Does the figure plotted by this package rorated by the mouse? I want > to combine the fMRI images into a brain template, like brainstorm does. Do > I chose the right pakage? > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > -- Vivek -------------- next part -------------- An HTML attachment was scrubbed... URL: From markiewicz at stanford.edu Tue Oct 20 09:55:42 2020 From: markiewicz at stanford.edu (Christopher Markiewicz) Date: Tue, 20 Oct 2020 13:55:42 +0000 Subject: [Neuroimaging] ANN: NiBabel 3.2 Message-ID: Hi all, NiBabel 3.2 is released today. Python 3.6+ and Numpy 1.14+ are supported in this version. Please cite this version with doi:10.5281/zenodo.4109791 (https://doi.org/10.5281/zenodo.4109791). This release includes two new commandline utilities: nib-roi and nib-stats. nib-roi allows cropping and flipping images using Python slicing syntax. nib-stats, and the Python API nibabel.imagestats, is inspired by fslstats, and is intended to provide common calculations on images. Much thanks to new contributors Jonathan Daniel, Mark?ta Cal?bkov?, Carl Gauthier and Julian Klug, as well as familiar faces who have reported bugs, submitted PRs and especially reviewed contributions. The next planned minor release series will be 4.0, which will see some deprecations and removals, so please pay attention to any warnings that may be popping up. Judging from this last round, we can probably expect a release candidate around February or March. The full changelog follows. Best, Chris Most work on NiBabel so far has been by Matthew Brett (MB), Chris Markiewicz (CM), Michael Hanke (MH), Marc-Alexandre C?t? (MC), Ben Cipollini (BC), Paul McCarthy (PM), Chris Cheng (CC), Yaroslav Halchenko (YOH), Satra Ghosh (SG), Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM). References like "pr/298" refer to github pull request numbers. 3.2.0 (Tuesday 20 October 2020) ============================== New feature release in the 3.2.x series. New features ------------ * ``nib-stats`` CLI tool to expose new ``nibabel.imagestats`` API. Initial implementation of volume calculations, a la ``fslstats -V``. (pr/952) (Julian Klug, reviewed by CM and GitHub user 0rC0) * ``nib-roi`` CLI tool to crop images and/or flip axes (pr/947) (CM, reviewed by Chris Cheng and Mathias Goncalves) * Parser for Siemens "ASCCONV" text format (pr/896) (Brendan Moloney and MB, reviewed by CM) Enhancements ------------ * Drop confusing mention of ``img.to_filename()`` in getting started guide (pr/946) (Fernando P?rez-Garcia, reviewed by MB, CM) * Implement ``to_bytes()``/``from_bytes()`` methods for ``Cifti2Image`` (pr/938) (CM, reviewed by Mathias Goncalves) * Clean up of DICOM documentation (pr/910) (Jonathan Daniel, reviewed by MB) Bug fixes --------- * Use canvas manager API to set title in ``OrthoSlicer3D`` (pr/958) (EL, reviewed by CM) * Record units as seconds parrec2nii; previously set TR to seconds but retained msec units (pr/931) (CM, reviewed by MB) * Reflect on-disk dimensions in NIfTI-2 view of CIFTI-2 images (pr/930) (Mathias Goncalves and CM) * Fix outdated Python 2 and Sympy code in DICOM derivations (pr/911) (MB, reviewed by CM) * Change string with invalid escape to raw string (pr/909) (EL, reviewed by MB) Maintenance ----------- * Fix typo in docs (pr/955) (Carl Gauthier, reviewed by CM) * Purge nose from nisext tests (pr/934) (Mark?ta Cal?bkov?, reviewed by CM) * Suppress expected warnings in tests (pr/949) (CM, reviewed by Dorota Jarecka) * Various cleanups and modernizations (pr/916, pr/917, pr/918, pr/919) (Jonathan Daniel, reviewed by CM) * SVG logo for improved appearance in with zooming (pr/914) (Jonathan Daniel, reviewed by CM) API changes and deprecations ---------------------------- * Drop support for Numpy < 1.13 (pr/922) (CM) * Warn on use of ``onetime.setattr_on_read``, which has been a deprecated alias of ``auto_attr`` (pr/948) (CM, reviewed by Ariel Rokem) -- Chris Markiewicz Center for Reproducible Neuroscience Stanford University -------------- next part -------------- An HTML attachment was scrubbed... URL: From bertrand.thirion at inria.fr Tue Oct 20 12:29:43 2020 From: bertrand.thirion at inria.fr (bthirion) Date: Tue, 20 Oct 2020 18:29:43 +0200 Subject: [Neuroimaging] ANN: NiBabel 3.2 In-Reply-To: References: Message-ID: <660907b4-c85a-c437-f8dd-37b953d157e7@inria.fr> Thx Chris ! B On 20/10/2020 15:55, Christopher Markiewicz wrote: > Hi all, > > NiBabel 3.2 is released today. Python 3.6+ and Numpy 1.14+ are > supported in this version. Please cite this version with > doi:10.5281/zenodo.4109791 (https://doi.org/10.5281/zenodo.4109791). > > This release includes two new commandline utilities: nib-roi and > nib-stats. nib-roi allows cropping and flipping images using Python > slicing syntax. nib-stats, and the Python API nibabel.imagestats, is > inspired by fslstats, and is intended to provide common calculations > on images. > > Much thanks to new contributors Jonathan Daniel, Mark?ta Cal?bkov?, > Carl Gauthier and Julian Klug, as well as familiar faces who have > reported bugs, submitted PRs and especially reviewed contributions. > > The next planned minor release series will be 4.0, which will see some > deprecations and removals, so please pay attention to any warnings > that may be popping up. Judging from this last round, we can probably > expect a release candidate around February or March. > > The full changelog follows. > > Best, > Chris > > Most work on NiBabel so far has been by Matthew Brett (MB), Chris > Markiewicz (CM), Michael Hanke (MH), Marc-Alexandre C?t? (MC), Ben > Cipollini (BC), Paul McCarthy (PM), Chris Cheng (CC), Yaroslav > Halchenko (YOH), Satra Ghosh (SG), Eric Larson (EL), Demian > Wassermann, Stephan Gerhard and Ross Markello (RM). > > References like "pr/298" refer to github pull request numbers. > > 3.2.0 (Tuesday 20 October 2020) > ============================== > > New feature release in the 3.2.x series. > > New features > ------------ > * ``nib-stats`` CLI tool to expose new ``nibabel.imagestats`` API. > Initial implementation of volume calculations, a la ``fslstats -V``. > (pr/952) (Julian Klug, reviewed by CM and GitHub user 0rC0) > * ``nib-roi`` CLI tool to crop images and/or flip axes (pr/947) (CM, > reviewed by Chris Cheng and Mathias Goncalves) > * Parser for Siemens "ASCCONV" text format (pr/896) (Brendan Moloney > and MB, reviewed by CM) > > Enhancements > ------------ > * Drop confusing mention of ``img.to_filename()`` in getting started > guide (pr/946) (Fernando P?rez-Garcia, reviewed by MB, CM) > * Implement ``to_bytes()``/``from_bytes()`` methods for > ``Cifti2Image`` (pr/938) (CM, reviewed by Mathias Goncalves) > * Clean up of DICOM documentation (pr/910) (Jonathan Daniel, reviewed > by MB) > > Bug fixes > --------- > * Use canvas manager API to set title in ``OrthoSlicer3D`` (pr/958) > (EL, reviewed by CM) > * Record units as seconds parrec2nii; previously set TR to seconds but > retained msec units (pr/931) (CM, reviewed by MB) > * Reflect on-disk dimensions in NIfTI-2 view of CIFTI-2 images > (pr/930) (Mathias Goncalves and CM) > * Fix outdated Python 2 and Sympy code in DICOM derivations (pr/911) > (MB, reviewed by CM) > * Change string with invalid escape to raw string (pr/909) (EL, > reviewed by MB) > > Maintenance > ----------- > * Fix typo in docs (pr/955) (Carl Gauthier, reviewed by CM) > * Purge nose from nisext tests (pr/934) (Mark?ta Cal?bkov?, reviewed > by CM) > * Suppress expected warnings in tests (pr/949) (CM, reviewed by Dorota > Jarecka) > * Various cleanups and modernizations (pr/916, pr/917, pr/918, pr/919) > (Jonathan Daniel, reviewed by CM) > * SVG logo for improved appearance in with zooming (pr/914) (Jonathan > Daniel, reviewed by CM) > > API changes and deprecations > ---------------------------- > * Drop support for Numpy < 1.13 (pr/922) (CM) > * Warn on use of ``onetime.setattr_on_read``, which has been a > deprecated alias of ``auto_attr`` (pr/948) (CM, reviewed by Ariel Rokem) > > -- > > Chris Markiewicz > > Center for Reproducible Neuroscience > > Stanford University > > > > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging -------------- next part -------------- An HTML attachment was scrubbed... URL: From jbpoline at gmail.com Tue Oct 20 17:33:24 2020 From: jbpoline at gmail.com (JB Poline) Date: Tue, 20 Oct 2020 17:33:24 -0400 Subject: [Neuroimaging] ANN: NiBabel 3.2 In-Reply-To: <660907b4-c85a-c437-f8dd-37b953d157e7@inria.fr> References: <660907b4-c85a-c437-f8dd-37b953d157e7@inria.fr> Message-ID: Indeed, thanks a lot ! On Tue, Oct 20, 2020 at 12:30 PM bthirion wrote: > Thx Chris ! > B > > On 20/10/2020 15:55, Christopher Markiewicz wrote: > > Hi all, > > NiBabel 3.2 is released today. Python 3.6+ and Numpy 1.14+ are supported > in this version. Please cite this version with doi:10.5281/zenodo.4109791 ( > https://doi.org/10.5281/zenodo.4109791). > > This release includes two new commandline utilities: nib-roi and > nib-stats. nib-roi allows cropping and flipping images using Python slicing > syntax. nib-stats, and the Python API nibabel.imagestats, is inspired by > fslstats, and is intended to provide common calculations on images. > > Much thanks to new contributors Jonathan Daniel, Mark?ta Cal?bkov?, Carl > Gauthier and Julian Klug, as well as familiar faces who have reported bugs, > submitted PRs and especially reviewed contributions. > > The next planned minor release series will be 4.0, which will see some > deprecations and removals, so please pay attention to any warnings that may > be popping up. Judging from this last round, we can probably expect a > release candidate around February or March. > > The full changelog follows. > > Best, > Chris > > Most work on NiBabel so far has been by Matthew Brett (MB), Chris > Markiewicz (CM), Michael Hanke (MH), Marc-Alexandre C?t? (MC), Ben > Cipollini (BC), Paul McCarthy (PM), Chris Cheng (CC), Yaroslav Halchenko > (YOH), Satra Ghosh (SG), Eric Larson (EL), Demian Wassermann, Stephan > Gerhard and Ross Markello (RM). > > References like "pr/298" refer to github pull request numbers. > > 3.2.0 (Tuesday 20 October 2020) > ============================== > > New feature release in the 3.2.x series. > > New features > ------------ > * ``nib-stats`` CLI tool to expose new ``nibabel.imagestats`` API. Initial > implementation of volume calculations, a la ``fslstats -V``. (pr/952) > (Julian Klug, reviewed by CM and GitHub user 0rC0) > * ``nib-roi`` CLI tool to crop images and/or flip axes (pr/947) (CM, > reviewed by Chris Cheng and Mathias Goncalves) > * Parser for Siemens "ASCCONV" text format (pr/896) (Brendan Moloney and > MB, reviewed by CM) > > Enhancements > ------------ > * Drop confusing mention of ``img.to_filename()`` in getting started guide > (pr/946) (Fernando P?rez-Garcia, reviewed by MB, CM) > * Implement ``to_bytes()``/``from_bytes()`` methods for ``Cifti2Image`` > (pr/938) (CM, reviewed by Mathias Goncalves) > * Clean up of DICOM documentation (pr/910) (Jonathan Daniel, reviewed by > MB) > > Bug fixes > --------- > * Use canvas manager API to set title in ``OrthoSlicer3D`` (pr/958) (EL, > reviewed by CM) > * Record units as seconds parrec2nii; previously set TR to seconds but > retained msec units (pr/931) (CM, reviewed by MB) > * Reflect on-disk dimensions in NIfTI-2 view of CIFTI-2 images (pr/930) > (Mathias Goncalves and CM) > * Fix outdated Python 2 and Sympy code in DICOM derivations (pr/911) (MB, > reviewed by CM) > * Change string with invalid escape to raw string (pr/909) (EL, reviewed > by MB) > > Maintenance > ----------- > * Fix typo in docs (pr/955) (Carl Gauthier, reviewed by CM) > * Purge nose from nisext tests (pr/934) (Mark?ta Cal?bkov?, reviewed by CM) > * Suppress expected warnings in tests (pr/949) (CM, reviewed by Dorota > Jarecka) > * Various cleanups and modernizations (pr/916, pr/917, pr/918, pr/919) > (Jonathan Daniel, reviewed by CM) > * SVG logo for improved appearance in with zooming (pr/914) (Jonathan > Daniel, reviewed by CM) > > API changes and deprecations > ---------------------------- > * Drop support for Numpy < 1.13 (pr/922) (CM) > * Warn on use of ``onetime.setattr_on_read``, which has been a deprecated > alias of ``auto_attr`` (pr/948) (CM, reviewed by Ariel Rokem) > > -- > > Chris Markiewicz > > Center for Reproducible Neuroscience > > Stanford University > > > _______________________________________________ > Neuroimaging mailing listNeuroimaging at python.orghttps://mail.python.org/mailman/listinfo/neuroimaging > > > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > -------------- next part -------------- An HTML attachment was scrubbed... URL: From uri.urie at gmail.com Sat Oct 24 14:05:58 2020 From: uri.urie at gmail.com (Uri Elias) Date: Sat, 24 Oct 2020 21:05:58 +0300 Subject: [Neuroimaging] using nibabel to convert a dtscalar parcellation (1-N for each greyordinate) to a 4d (binary slice for each parcel) dtseries Message-ID: Hi All, Top level - I'd like to apply dual regression on rest fMRI based on parcellation where my rs-fMRI data in in CIFTI format. For a dual-regression SW I've chosen FSL, also because it works on Cifti (according to manual). For parcellation I've chosen the Schaefer parcellation, as it is Cifti-available and also partially based on rest-fMRI. Now, the Cifti parcellation file is a dscalar file (that is - a single volume/surface), with each greyordinate belongs to one of N parcels. FSL (AFAIU) requires a 4D file as a reference Working with nibabel, reformatting the matrix is easy - reading it with nibabel and do something like: for k in range(N): newdata[k,:] = (orgdata==k+1).astype(float) Updating the Nifti header is also easy - newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header) newobj.update_headers() The problem with this way is the the Cifti header is not being updated - newobj.header.matrix.get_data_shape() yeilds (1, 64984) What's a good way of doing this? - either by sticking to the nibabel->FSL line right or by any alternative Thanks all so much, Uri -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [image: www.neuropsychiatrylab.com] [image: facebook] [image: linkedin] -------------- next part -------------- An HTML attachment was scrubbed... URL: From michiel.cottaar at ndcn.ox.ac.uk Sun Oct 25 07:50:37 2020 From: michiel.cottaar at ndcn.ox.ac.uk (Michiel Cottaar) Date: Sun, 25 Oct 2020 11:50:37 +0000 Subject: [Neuroimaging] using nibabel to convert a dtscalar parcellation (1-N for each greyordinate) to a 4d (binary slice for each parcel) dtseries In-Reply-To: References: Message-ID: Hi Uri, You will have to tell Cifti what is along this new axis you created. One way to do this is to use the cifti2 axes (https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes). After creating newdata this would look like: >>> from nibabel import cifti2 >>> new_axis = cifti2.ScalarAxis([f"parcel {idx + 1}" for idx in range(N)]) # these are the names for all the parcels; you might want to replace them with something more meaningfull >>> grayordinate_axis = dsobj.header.get_axis(1) # get a description of the greyordinate space from the loaded CIFTI file >>> newobj = nb.Cifti2Image(newdata, (new_axis, grayordinate_axis)) # creates a new Cifti2 header based on these axes This newobj will have the shape of (N, 64984) for N parcels. However, based on your description I'm not completely sure if this is what you want to be doing. The output will still be a 2D CIFTI file rather than a 4D NIFTI file. If you want the latter, just reshape the newdata to be 4D using something like `newdata.T.reshape(64984, 1, 1, N)` and create a new nb.Nifti1Image object from that data. Good luck, Michiel On 24 Oct 2020, at 19:05, Uri Elias > wrote: Hi All, Top level - I'd like to apply dual regression on rest fMRI based on parcellation where my rs-fMRI data in in CIFTI format. For a dual-regression SW I've chosen FSL, also because it works on Cifti (according to manual). For parcellation I've chosen the Schaefer parcellation, as it is Cifti-available and also partially based on rest-fMRI. Now, the Cifti parcellation file is a dscalar file (that is - a single volume/surface), with each greyordinate belongs to one of N parcels. FSL (AFAIU) requires a 4D file as a reference Working with nibabel, reformatting the matrix is easy - reading it with nibabel and do something like: for k in range(N): newdata[k,:] = (orgdata==k+1).astype(float) Updating the Nifti header is also easy - newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header) newobj.update_headers() The problem with this way is the the Cifti header is not being updated - newobj.header.matrix.get_data_shape() yeilds (1, 64984) What's a good way of doing this? - either by sticking to the nibabel->FSL line right or by any alternative Thanks all so much, Uri -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [www.neuropsychiatrylab.com] [facebook] [linkedin] _______________________________________________ Neuroimaging mailing list Neuroimaging at python.org https://mail.python.org/mailman/listinfo/neuroimaging -------------- next part -------------- An HTML attachment was scrubbed... URL: From uri.urie at gmail.com Sun Oct 25 17:08:58 2020 From: uri.urie at gmail.com (Uri Elias) Date: Sun, 25 Oct 2020 23:08:58 +0200 Subject: [Neuroimaging] using nibabel to convert a dtscalar parcellation (1-N for each greyordinate) to a 4d (binary slice for each parcel) dtseries In-Reply-To: References: Message-ID: Thanks! I may indeed try that, but before - and because you were doubtful about this sort of pipeline - I'll try to go over again - I want to get an "individualized atlas" by taking one and using it as a reference to dual regression (on a rest state time series), all this over Cifti. Does that make sense? If so, what's the best way of doing so? On Sun, Oct 25, 2020 at 2:08 PM Michiel Cottaar < michiel.cottaar at ndcn.ox.ac.uk> wrote: > Hi Uri, > > You will have to tell Cifti what is along this new axis you created. One > way to do this is to use the cifti2 axes ( > https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes). > After creating newdata this would look like: > >>> from nibabel import cifti2 > >>> new_axis = cifti2.ScalarAxis([f"parcel {idx + 1}" for idx in > range(N)]) # these are the names for all the parcels; you might want to > replace them with something more meaningfull > >>> grayordinate_axis = dsobj.header.get_axis(1) # get a description of > the greyordinate space from the loaded CIFTI file > >>> newobj = nb.Cifti2Image(newdata, (new_axis, grayordinate_axis)) # > creates a new Cifti2 header based on these axes > This newobj will have the shape of (N, 64984) for N parcels. > > However, based on your description I'm not completely sure if this is what > you want to be doing. The output will still be a 2D CIFTI file rather than > a 4D NIFTI file. If you want the latter, just reshape the newdata to be 4D > using something like `newdata.T.reshape(64984, 1, 1, N)` and create a new > nb.Nifti1Image object from that data. > > Good luck, > > Michiel > > On 24 Oct 2020, at 19:05, Uri Elias wrote: > > > > Hi All, > > Top level - I'd like to apply dual regression on rest fMRI based on > parcellation where my rs-fMRI data in in CIFTI format. > > For a dual-regression SW I've chosen FSL, also because it works on Cifti > (according to manual). > For parcellation I've chosen the Schaefer parcellation, as it is > Cifti-available and also partially based on rest-fMRI. > > Now, the Cifti parcellation file is a dscalar file (that is - a single > volume/surface), with each greyordinate belongs to one of N parcels. FSL > (AFAIU) requires a 4D file as a reference > Working with nibabel, reformatting the matrix is easy - reading it with > nibabel and do something like: for k in range(N): > newdata[k,:] = (orgdata==k+1).astype(float) > > Updating the Nifti header is also easy - > newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header) > newobj.update_headers() > > The problem with this way is the the Cifti header is not being updated - > newobj.header.matrix.get_data_shape() > yeilds > (1, 64984) > > What's a good way of doing this? - either by sticking to the nibabel->FSL > line right or by any alternative > > Thanks all so much, > Uri > > -- > Uri Elias > Computational Neuropsychiatry Lab > Hadassah Hebrew University Medical School > [image: www.neuropsychiatrylab.com] > > [image: facebook] > [image: linkedin] > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > > > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [image: www.neuropsychiatrylab.com] [image: facebook] [image: linkedin] -------------- next part -------------- An HTML attachment was scrubbed... URL: From michiel.cottaar at ndcn.ox.ac.uk Mon Oct 26 05:43:54 2020 From: michiel.cottaar at ndcn.ox.ac.uk (Michiel Cottaar) Date: Mon, 26 Oct 2020 09:43:54 +0000 Subject: [Neuroimaging] using nibabel to convert a dtscalar parcellation (1-N for each greyordinate) to a 4d (binary slice for each parcel) dtseries In-Reply-To: References: Message-ID: <373B02F6-DBF7-4004-83B2-662C0A302652@ndcn.ox.ac.uk> Hi, That makes sense. As described on https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/DualRegression dual regression is just doing a linear regression twice, once to get subject-specific time courses, and a second time to get subject-specific spatial maps. I can't answer your question on which data format to use, because that depends on which tool you are going to use to do the regressions. If that tool supports CIFTI data, you can produce a CIFTI file with the correct shape as described in my previous email. But, if it only supports NIFTI data you will have to create the 4D NIFTI file. If you are happy to run your regression within python, you will be able to pass on your newdata array directly without writing to disk. There are a lot of excellent tools to do linear regression, so it is really up to you to decide which one you find easiest to use. Best wishes, Michiel On 25 Oct 2020, at 21:08, Uri Elias > wrote: Thanks! I may indeed try that, but before - and because you were doubtful about this sort of pipeline - I'll try to go over again - I want to get an "individualized atlas" by taking one and using it as a reference to dual regression (on a rest state time series), all this over Cifti. Does that make sense? If so, what's the best way of doing so? On Sun, Oct 25, 2020 at 2:08 PM Michiel Cottaar > wrote: Hi Uri, You will have to tell Cifti what is along this new axis you created. One way to do this is to use the cifti2 axes (https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes). After creating newdata this would look like: >>> from nibabel import cifti2 >>> new_axis = cifti2.ScalarAxis([f"parcel {idx + 1}" for idx in range(N)]) # these are the names for all the parcels; you might want to replace them with something more meaningfull >>> grayordinate_axis = dsobj.header.get_axis(1) # get a description of the greyordinate space from the loaded CIFTI file >>> newobj = nb.Cifti2Image(newdata, (new_axis, grayordinate_axis)) # creates a new Cifti2 header based on these axes This newobj will have the shape of (N, 64984) for N parcels. However, based on your description I'm not completely sure if this is what you want to be doing. The output will still be a 2D CIFTI file rather than a 4D NIFTI file. If you want the latter, just reshape the newdata to be 4D using something like `newdata.T.reshape(64984, 1, 1, N)` and create a new nb.Nifti1Image object from that data. Good luck, Michiel On 24 Oct 2020, at 19:05, Uri Elias > wrote: Hi All, Top level - I'd like to apply dual regression on rest fMRI based on parcellation where my rs-fMRI data in in CIFTI format. For a dual-regression SW I've chosen FSL, also because it works on Cifti (according to manual). For parcellation I've chosen the Schaefer parcellation, as it is Cifti-available and also partially based on rest-fMRI. Now, the Cifti parcellation file is a dscalar file (that is - a single volume/surface), with each greyordinate belongs to one of N parcels. FSL (AFAIU) requires a 4D file as a reference Working with nibabel, reformatting the matrix is easy - reading it with nibabel and do something like: for k in range(N): newdata[k,:] = (orgdata==k+1).astype(float) Updating the Nifti header is also easy - newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header) newobj.update_headers() The problem with this way is the the Cifti header is not being updated - newobj.header.matrix.get_data_shape() yeilds (1, 64984) What's a good way of doing this? - either by sticking to the nibabel->FSL line right or by any alternative Thanks all so much, Uri -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [www.neuropsychiatrylab.com] [facebook] [linkedin] _______________________________________________ Neuroimaging mailing list Neuroimaging at python.org https://mail.python.org/mailman/listinfo/neuroimaging _______________________________________________ Neuroimaging mailing list Neuroimaging at python.org https://mail.python.org/mailman/listinfo/neuroimaging -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [www.neuropsychiatrylab.com] [facebook] [linkedin] _______________________________________________ Neuroimaging mailing list Neuroimaging at python.org https://mail.python.org/mailman/listinfo/neuroimaging -------------- next part -------------- An HTML attachment was scrubbed... URL: From uri.urie at gmail.com Tue Oct 27 03:20:37 2020 From: uri.urie at gmail.com (Uri Elias) Date: Tue, 27 Oct 2020 09:20:37 +0200 Subject: [Neuroimaging] using nibabel to convert a dtscalar parcellation (1-N for each greyordinate) to a 4d (binary slice for each parcel) dtseries In-Reply-To: <373B02F6-DBF7-4004-83B2-662C0A302652@ndcn.ox.ac.uk> References: <373B02F6-DBF7-4004-83B2-662C0A302652@ndcn.ox.ac.uk> Message-ID: Python is robust and easy to use given you know its foundations, however, designated tools are generally more safe to use. Anyway, for whom may be interested in the following answer I've found on the HCP channel - the goto command in HCP-workbench is >> wb_command -cifti-all-labels-to-rois apparently it does the exact transformation I described. For me, this thread has ended. Thanks again. On Mon, Oct 26, 2020 at 11:44 AM Michiel Cottaar < michiel.cottaar at ndcn.ox.ac.uk> wrote: > Hi, > > That makes sense. As described on > https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/DualRegression dual regression is > just doing a linear regression twice, once to get subject-specific time > courses, and a second time to get subject-specific spatial maps. > > I can't answer your question on which data format to use, because that > depends on which tool you are going to use to do the regressions. If that > tool supports CIFTI data, you can produce a CIFTI file with the correct > shape as described in my previous email. But, if it only supports NIFTI > data you will have to create the 4D NIFTI file. If you are happy to run > your regression within python, you will be able to pass on your newdata > array directly without writing to disk. There are a lot of excellent tools > to do linear regression, so it is really up to you to decide which one you > find easiest to use. > > Best wishes, > > Michiel > > On 25 Oct 2020, at 21:08, Uri Elias wrote: > > Thanks! > > I may indeed try that, but before - and because you were doubtful about > this sort of pipeline - I'll try to go over again - > > I want to get an "individualized atlas" by taking one and using it as a > reference to dual regression (on a rest state time series), all this over > Cifti. Does that make sense? If so, what's the best way of doing so? > > > > > > On Sun, Oct 25, 2020 at 2:08 PM Michiel Cottaar < > michiel.cottaar at ndcn.ox.ac.uk> wrote: > >> Hi Uri, >> >> You will have to tell Cifti what is along this new axis you created. One >> way to do this is to use the cifti2 axes ( >> https://nipy.org/nibabel/reference/nibabel.cifti2.html#module-nibabel.cifti2.cifti2_axes). >> After creating newdata this would look like: >> >>> from nibabel import cifti2 >> >>> new_axis = cifti2.ScalarAxis([f"parcel {idx + 1}" for idx in >> range(N)]) # these are the names for all the parcels; you might want to >> replace them with something more meaningfull >> >>> grayordinate_axis = dsobj.header.get_axis(1) # get a description of >> the greyordinate space from the loaded CIFTI file >> >>> newobj = nb.Cifti2Image(newdata, (new_axis, grayordinate_axis)) # >> creates a new Cifti2 header based on these axes >> This newobj will have the shape of (N, 64984) for N parcels. >> >> However, based on your description I'm not completely sure if this is >> what you want to be doing. The output will still be a 2D CIFTI file rather >> than a 4D NIFTI file. If you want the latter, just reshape the newdata to >> be 4D using something like `newdata.T.reshape(64984, 1, 1, N)` and create a >> new nb.Nifti1Image object from that data. >> >> Good luck, >> >> Michiel >> >> On 24 Oct 2020, at 19:05, Uri Elias wrote: >> >> >> >> Hi All, >> >> Top level - I'd like to apply dual regression on rest fMRI based on >> parcellation where my rs-fMRI data in in CIFTI format. >> >> For a dual-regression SW I've chosen FSL, also because it works on Cifti >> (according to manual). >> For parcellation I've chosen the Schaefer parcellation, as it is >> Cifti-available and also partially based on rest-fMRI. >> >> Now, the Cifti parcellation file is a dscalar file (that is - a single >> volume/surface), with each greyordinate belongs to one of N parcels. FSL >> (AFAIU) requires a 4D file as a reference >> Working with nibabel, reformatting the matrix is easy - reading it with >> nibabel and do something like: for k in range(N): >> newdata[k,:] = (orgdata==k+1).astype(float) >> >> Updating the Nifti header is also easy - >> newobj = nb.Cifti2Image(newdata, dscobj.header, dscobj.nifti_header) >> newobj.update_headers() >> >> The problem with this way is the the Cifti header is not being updated - >> newobj.header.matrix.get_data_shape() >> yeilds >> (1, 64984) >> >> What's a good way of doing this? - either by sticking to the nibabel->FSL >> line right or by any alternative >> >> Thanks all so much, >> Uri >> >> -- >> Uri Elias >> Computational Neuropsychiatry Lab >> Hadassah Hebrew University Medical School >> [image: www.neuropsychiatrylab.com] >> >> [image: facebook] >> [image: linkedin] >> _______________________________________________ >> Neuroimaging mailing list >> Neuroimaging at python.org >> https://mail.python.org/mailman/listinfo/neuroimaging >> >> >> _______________________________________________ >> Neuroimaging mailing list >> Neuroimaging at python.org >> https://mail.python.org/mailman/listinfo/neuroimaging >> > > > -- > Uri Elias > Computational Neuropsychiatry Lab > Hadassah Hebrew University Medical School > [image: www.neuropsychiatrylab.com] > > [image: facebook] > [image: linkedin] > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > > > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > -- Uri Elias Computational Neuropsychiatry Lab Hadassah Hebrew University Medical School [image: www.neuropsychiatrylab.com] [image: facebook] [image: linkedin] -------------- next part -------------- An HTML attachment was scrubbed... URL: From Michael.Stevens at hhchealth.org Thu Oct 29 11:07:55 2020 From: Michael.Stevens at hhchealth.org (Stevens, Michael) Date: Thu, 29 Oct 2020 15:07:55 +0000 Subject: [Neuroimaging] fMRIPrep issue on SGE architecture Message-ID: We're implementing fMRIPrep via Singularity container on a Linux cluster where we have an system architecture that functions as an interface to copy MRI data from an archive as well as a behind-the-scenes bash script-running environment to string together complex data-processing pipelines. In a typical scenario, this system will a) pull our fMRI/sMRI data and copy it over to a working storage array (i.e., a 'work' location), then execute a series of command line calls (e.g., to set env or path settings, move files or create directories, etc) and/or invoke various bash scripts in sequence... This whole string of 'pipeline' commands are served through a Sun Grid Engine to execute on the various compute nodes of our cluster. Interestingly, I can get fMRIPrep to engage just fine on this system pretty easily. But once it gets going for a while it crashes... oh, maybe 30-45 minutes into things... with an error about the 'fsaverage' file structure access: shutil.Error: [('/opt/freesurfer/subjects/fsaverage/label', '/home/pipeline/onrc/data2/pipelineb/AutOO_fmriprep_ciftify/S0211BRU/1/derivatives/freesurfer/fsaverage/label', "[Errno 1] Operation not permitted: '/home/pipeline/onrc/data2/pipelineb/AutOO_fmriprep_ciftify/S0211BRU/1/derivatives/freesurfer/fsaverage/label'"), This list of errors goes on for about a dozen files within ../fsaverage (including the contents of the mri, surf, xhemi) and ends with an overall message that seems (?) as if it just doesn't like the entire 'fsaverage' folder that fMRIPrep copies over: PosixPath('/home/pipeline/onrc/data2/pipelineb/AutOO_fmriprep_ciftify/S0211BRU/1/derivatives/freesurfer/fsaverage'), "[Errno 1] Operation not permitted: '/home/pipeline/onrc/data2/pipelineb/AutOO_fmriprep_ciftify/S0211BRU/1/derivatives/freesurfer/fsaverage'")] (Please note, the path name in those errors refers to 'fmriprep_ciftify', but the whole ciftify thing is a secondary step for older, archived data we're playing with... Here, I'm really talking about running just 'fMRIPrep' itself, using a recent v20.2.0 version. Don't be thrown off by the name... that code has nothing to do with this pipeline.) Now, the crash happens with any dataset we try. But interestingly, the crash ONLY happens when the system I described above is processing the data. In contrast, if I try to use the same data file structure that was set up by our system, and invoke the EXACT SAME fMRIPrep bash script call (i.e., in the same location), it all runs fine... A-to-Z. So there's something tricky about how our system architecture and Singularity container are not getting along that I can't quite figure out. I did some Google searching on the error, but only turned up one thing that looked relevant. A prior listserv post somewhere says they ran into something similar using the -u UID option. The issue there was an incompatibility for file permissions between linux accounts that set up vs. were trying to process the data. This felt like a plausible issue here given our architecture. But a) I wasn't using the -u UID option to begin with (so there couldn't have been a purposeful incompatibility, merely one that possibly arises from issues I'm not aware of), and b) a variety of things I tried to manually intervene to overcome this issue (e.g., copying over fsaverage BEFORE fMRIPrep tried to do it itself, using chmod to make sure it had full 777 read/write permissions, etc.) all failed. I'm wondering if anyone can suggest a few things to look into to troubleshoot this issue? It might be as simple as making clever use of the -u UID option as a fix... something I haven't really tried in depth yet. Or this might be an altogether different problem than the issue above from the prior listserv post I dug up. But I'd appreciate any direction in how to solve things. Best, Mike This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message, including any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chantel.charlebois at utah.edu Thu Oct 29 12:40:31 2020 From: chantel.charlebois at utah.edu (CHANTEL MARIE CHARLEBOIS) Date: Thu, 29 Oct 2020 16:40:31 +0000 Subject: [Neuroimaging] 3DSlicer with nipype Message-ID: <043858A6-A4E6-48CF-8936-CD9DF1238897@utah.edu> Hello, I am trying to use the 3DSlicer interface with nipype and was wondering if anyone has any example scripts or can share how they have setup Slicer to work with nipype in the past. I am interested in getting the ModelToLabelMap function working but would also use other Slicer modules if I can get it working. Best, Chantel -- Chantel M. Charlebois NSF Graduate Research Fellow Ph.D. Candidate | Department of Biomedical Engineering Scientific Computing & Imaging Institute Butson Lab & Dorval Lab University of Utah -------------- next part -------------- An HTML attachment was scrubbed... URL: From fbriend at hotmail.fr Thu Oct 29 14:34:57 2020 From: fbriend at hotmail.fr (=?utf-8?B?RnLDqWTDqXJpYyBCcmllbmQ=?=) Date: Thu, 29 Oct 2020 18:34:57 +0000 Subject: [Neuroimaging] 3DSlicer with nipype References: <043858A6-A4E6-48CF-8936-CD9DF1238897@utah.edu> Message-ID: Hi Chantel, You can directly use the Slicer python idle (right icon in 3dSlicer) and import nipype inside. Then, I suppose you will use this command: segmentLabelmapNode = slicer.vtkMRMLLabelMapVolumeNode Best, Frederic -------------- next part -------------- An HTML attachment was scrubbed... URL: From christophe at pallier.org Fri Oct 30 08:44:17 2020 From: christophe at pallier.org (Christophe Pallier) Date: Fri, 30 Oct 2020 13:44:17 +0100 Subject: [Neuroimaging] mayavi issue with pysurfer Message-ID: Dear all, When I call add_overlay() on a Brain object (as in the first example script from pysurfer's documentation), I get the following error: Exception occurred in traits notification handler for object: , trait: data_range, old value: [0. 1.], new value: [ 1.e+299 -1.e+299] Traceback (most recent call last): File "/home/cp983411/anaconda3/envs/neuroimaging/lib/python3.7/site-packages/traits/trait_notifiers.py", line 340, in __call__ self.handler(*args) File "/home/cp983411/anaconda3/envs/neuroimaging/lib/python3.7/site-packages/mayavi/core/lut_manager.py", line 434, in _data_range_changed assert value[0] <= value[1] AssertionError Any idea? Christophe Pallier (http://www.pallier.org) INSERM Cognitive Neuroimaging Lab (http://www.unicog.org) -------------- next part -------------- An HTML attachment was scrubbed... URL: