From pini.lorenzo2 at gmail.com Mon May 9 09:59:16 2022 From: pini.lorenzo2 at gmail.com (Lorenzo Pini) Date: Mon, 9 May 2022 15:59:16 +0200 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file Message-ID: Dear experts, I uploaded a 3D nifti file with nibabel, transformed it into a 1D array and performed some transformations. My final 1D array has size 902629 (MNI vector space). Now, I would like to convert this 1D array back to a 3D nifti image. Any advice to perform this operation? Thankx, L -------------- next part -------------- An HTML attachment was scrubbed... URL: From markiewicz at stanford.edu Mon May 9 10:05:43 2022 From: markiewicz at stanford.edu (Christopher Markiewicz) Date: Mon, 9 May 2022 14:05:43 +0000 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file In-Reply-To: References: Message-ID: Hi Lorenzo, Assuming all you did was flatten the array, you should be able to simply reshape the array to the image shape: new_img = Nifti1Image(arr.reshape(old_img.shape), old_img.affine, old_img.header)? Note that this preserves the affine and type of the input image, so if either of those has changed under your transformations, then you will need to pass the updated affine and call set_data_dtype()? after creation. Best, Chris ________________________________ From: Neuroimaging on behalf of Lorenzo Pini Sent: Monday, May 9, 2022 09:59 To: Neuroimaging analysis in Python Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file Dear experts, I uploaded a 3D nifti file with nibabel, transformed it into a 1D array and performed some transformations. My final 1D array has size 902629 (MNI vector space). Now, I would like to convert this 1D array back to a 3D nifti image. Any advice to perform this operation? Thankx, L -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at onerussian.com Mon May 9 17:44:09 2022 From: lists at onerussian.com (Yaroslav Halchenko) Date: Mon, 9 May 2022 17:44:09 -0400 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file In-Reply-To: References: Message-ID: I would have recommended to "go back" and to avoid explicit flattening / re-3ding etc. Why you had to go into 1D? PS reminded me about an excellent sci-fi book "Three body problem" where poor folks had to dry up to survive through apocalypses (and being rolled up and stored deep underground) and then rehydrate, so in effect do 3D -> 2D -> 3D ;) not sure how they survived ;) On Mon, 09 May 2022, Lorenzo Pini wrote: > Dear experts,? > I uploaded a 3D nifti file with nibabel, transformed it into a 1D array > and performed some transformations. My final 1D array has size 902629 (MNI > vector space).? > Now, I would like to convert this 1D array back to a 3D nifti image. Any > advice to?perform this operation? > Thankx, > L > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging -- Yaroslav O. Halchenko Center for Open Neuroscience http://centerforopenneuroscience.org Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 WWW: http://www.linkedin.com/in/yarik From christophe at pallier.org Tue May 10 01:45:47 2022 From: christophe at pallier.org (Christophe Pallier) Date: Tue, 10 May 2022 07:45:47 +0200 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file In-Reply-To: References: Message-ID: Well there are scenarios where it totally makes sense to transform to 1D, for example to use some sklearn functions that require vectors. In such cases, I find that nilearn's niftimaskers are a simple tool to go from 3d (or 4d) to 1d (or 2d), and vice versa. On Tue, May 10, 2022, 00:03 Yaroslav Halchenko wrote: > I would have recommended to "go back" and to avoid explicit flattening / > re-3ding etc. Why you had to go into 1D? > > PS reminded me about an excellent sci-fi book "Three body problem" where > poor folks had to dry up to survive through apocalypses (and being > rolled up and stored deep underground) and then rehydrate, so in > effect do 3D -> 2D -> 3D ;) not sure how they survived ;) > > On Mon, 09 May 2022, Lorenzo Pini wrote: > > > Dear experts, > > I uploaded a 3D nifti file with nibabel, transformed it into a 1D > array > > and performed some transformations. My final 1D array has size 902629 > (MNI > > vector space). > > Now, I would like to convert this 1D array back to a 3D nifti image. > Any > > advice to perform this operation? > > Thankx, > > L > > > _______________________________________________ > > Neuroimaging mailing list > > Neuroimaging at python.org > > https://mail.python.org/mailman/listinfo/neuroimaging > > > -- > Yaroslav O. Halchenko > Center for Open Neuroscience http://centerforopenneuroscience.org > Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 > WWW: http://www.linkedin.com/in/yarik > > _______________________________________________ > Neuroimaging mailing list > Neuroimaging at python.org > https://mail.python.org/mailman/listinfo/neuroimaging > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pini.lorenzo2 at gmail.com Tue May 10 07:28:42 2022 From: pini.lorenzo2 at gmail.com (Lorenzo Pini) Date: Tue, 10 May 2022 13:28:42 +0200 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file In-Reply-To: References: Message-ID: Thanks a lot for the clarification! I was able to "go back" to the original nifti image. Il giorno mar 10 mag 2022 alle ore 07:46 Christophe Pallier < christophe at pallier.org> ha scritto: > Well there are scenarios where it totally makes sense to transform to 1D, > for example to use some sklearn functions that require vectors. > > In such cases, I find that nilearn's niftimaskers are a simple tool to go > from 3d (or 4d) to 1d (or 2d), and vice versa. > > > > On Tue, May 10, 2022, 00:03 Yaroslav Halchenko > wrote: > >> I would have recommended to "go back" and to avoid explicit flattening / >> re-3ding etc. Why you had to go into 1D? >> >> PS reminded me about an excellent sci-fi book "Three body problem" where >> poor folks had to dry up to survive through apocalypses (and being >> rolled up and stored deep underground) and then rehydrate, so in >> effect do 3D -> 2D -> 3D ;) not sure how they survived ;) >> >> On Mon, 09 May 2022, Lorenzo Pini wrote: >> >> > Dear experts, >> > I uploaded a 3D nifti file with nibabel, transformed it into a 1D >> array >> > and performed some transformations. My final 1D array has size >> 902629 (MNI >> > vector space). >> > Now, I would like to convert this 1D array back to a 3D nifti image. >> Any >> > advice to perform this operation? >> > Thankx, >> > L >> >> > _______________________________________________ >> > Neuroimaging mailing list >> > Neuroimaging at python.org >> > https://mail.python.org/mailman/listinfo/neuroimaging >> >> >> -- >> Yaroslav O. Halchenko >> Center for Open Neuroscience http://centerforopenneuroscience.org >> Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 >> WWW: http://www.linkedin.com/in/yarik >> >> _______________________________________________ >> 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 > -- *Lorenzo Pini, PhD * *Padova Neuroscience Center, PNC* Universit? degli Studi di Padova -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at onerussian.com Tue May 10 10:58:01 2022 From: lists at onerussian.com (Yaroslav Halchenko) Date: Tue, 10 May 2022 10:58:01 -0400 Subject: [Neuroimaging] writing a 1D python array to 3D Nifti file In-Reply-To: References: Message-ID: On Tue, 10 May 2022, Christophe Pallier wrote: > Well there? are scenarios where it totally makes sense to transform to 1D, > for example to use some sklearn functions that require vectors. > In such cases, I find that nilearn's niftimaskers are a simple tool to go > from 3d (or 4d) to 1d (or 2d), and vice versa. FAIR ENOUGH! Indeed in those cases -- flattening might be required and the use of tools for transformations of such kind is advisable (especially whenever masking is involved). I guess I just saw way too many unnecessary uses of flattening whenever data could have been manipulated in their native ND form thanks to super-powerful broadcasting numpy supports. Cheers, -- Yaroslav O. Halchenko Center for Open Neuroscience http://centerforopenneuroscience.org Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755 WWW: http://www.linkedin.com/in/yarik From redhatw at gmail.com Wed May 25 15:47:45 2022 From: redhatw at gmail.com (Ze Wang) Date: Wed, 25 May 2022 19:47:45 +0000 Subject: [Neuroimaging] postdoc position in University of Maryland School of Medicine In-Reply-To: References: Message-ID: >We are still looking for a highly motivated Postdoc Research Fellow or >Research Associate in neuroimaging data processing. We are particularly >interested in time series analysis, graph theory, gradient analysis, >connectome analysis, and machine learning. The position is immediately >available from June 2022 until filled. The candidate will be supported >by a NIH R01 project. The ideal candidate should method development >experience in fMRI or neuroimaging signal processing. Experience of >clustering and graph analysis will be preferred. Python, Matlab >programming skills are required. Experience on multi-band fMRI data >processing is considered a plus. > >Candidates for these positions are expected to have good communication >skills and have good writing skills. We are willing to provide >competitive salary. > >Interested candidates should send CV and a brief introduction to Ze >Wang: ze.wang at som.umaryland.edu. > > >Information about Dr. Wang?s lab can be found in: > > >https://www.medschool.umaryland.edu/pi/Ze-Wang-PhD/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: