Closed rudolph-the-red-nose-reindeer closed 3 years ago
gzip is a type of zipping that's different from zip. If you want to zip an individual file, you should use gzip file.nii. Also, the above code zipped up a number of files, you should likely pass only 1 in.
Please provide a MCVE: https://stackoverflow.com/help/mcve. In any example, I recommend using a reproducible example using the reprex package (https://github.com/tidyverse/reprex). Also, please include a sessioninfo::session_info() output.
Hello again, I was wondering why you say to zip only a single file when I have multiple .nii files from different time points in a single fmri session and want to use all of them?
Here is my MCVE:
library(oro.nifti) library(spm12r) library(neurobase) library(matlabr) library(sessioninfo) setwd("~/9299_07N_results/fmri9299_07") fmri = readnii("fmri.nii.gz")
When I do this I get the error: 'Error in if (any(bad_pixdim)) { : missing value where TRUE/FALSE needed'
This error does not occur when I do readnii("singlefile.nii")
Here is my sessioninfo:
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.0.1 (2020-06-06)
os macOS Mojave 10.14.6
system x86_64, darwin17.0
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2020-12-21
─ Packages ───────────────────────────────────────────────────────────────────
package version date lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 4.0.0)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
bitops 1.0-6 2013-08-17 [1] CRAN (R 4.0.0)
cli 2.2.0 2020-11-20 [1] CRAN (R 4.0.2)
crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
git2r 0.27.1 2020-05-03 [1] CRAN (R 4.0.0)
glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.0)
kirby21.base 1.7.0 2018-08-13 [1] CRAN (R 4.0.0)
kirby21.fmri 1.7.0 2018-08-13 [1] CRAN (R 4.0.0)
magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0)
matlabr 1.5.2 2018-08-13 [1] CRAN (R 4.0.0)
matrixStats 0.56.0 2020-03-13 [1] CRAN (R 4.0.0)
neurobase 1.29.0 2020-01-14 [1] CRAN (R 4.0.0)
oro.nifti 0.10.3 2020-06-08 [1] CRAN (R 4.0.0)
R.methodsS3 1.8.0 2020-02-14 [1] CRAN (R 4.0.0)
R.oo 1.23.0 2019-11-03 [1] CRAN (R 4.0.0)
R.utils 2.9.2 2019-12-08 [1] CRAN (R 4.0.0)
Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0)
RNifti 1.1.0 2020-01-31 [1] CRAN (R 4.0.0)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2)
spm12r * 2.8.1 2019-01-09 [1] CRAN (R 4.0.0)
stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0)
stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2)
Thanks - but the MCVE is only verifiable with the file. The fmri.nii.gz is a 4D NIfTI file of all the images, not a zipped directory of nii files, correct? If so, please post.
Hello, I believe that fmri.nii.gz is a zipped directory of the nii files. I believe this because I have a folder of multiple nii files and I zipped them together using 'zip fmri.nii.gz s*.nii'.
If it helps, this is what happens when I do readnii(singlefile.nii):
NIfTI-1 format Type : nifti Data Type : 4 (INT16) Bits per Pixel : 16 Slice Code : 0 (Unknown) Intent Code : 0 (None) Qform Code : 1 (Scanner_Anat) Sform Code : 1 (Scanner_Anat) Dimension : 64 x 64 x 36 Pixel Dimension : 3.75 x 3.75 x 4 Voxel Units : mm Time Units : sec
Thank you for your help!
So you need to merge all the 3D files into a 4D file before running, you cannot upload a zip file of 3D files. See something like fslmerge: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Fslutils or http://akiraoconnor.org/2012/04/25/converting-3d-nifti-images-to-a-4d-image-with-spm/ Best, John
On Mon, Dec 21, 2020 at 1:39 PM rudolph-the-red-nose-reindeer < notifications@github.com> wrote:
Hello, I believe that fmri.nii.gz is a zipped directory of the nii files. I believe this because I have a folder of multiple nii files and I zipped them together using 'zip fmri.nii.gz s*.nii'.
If it helps, this is what happens when I do readnii(singlefile.nii):
NIfTI-1 format Type : nifti Data Type : 4 (INT16) Bits per Pixel : 16 Slice Code : 0 (Unknown) Intent Code : 0 (None) Qform Code : 1 (Scanner_Anat) Sform Code : 1 (Scanner_Anat) Dimension : 64 x 64 x 36 Pixel Dimension : 3.75 x 3.75 x 4 Voxel Units : mm Time Units : sec
Thank you for your help!
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/muschellij2/spm12r/issues/4#issuecomment-749130371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGPLWS7B2IZHACJLZNOMLSV6I6VANCNFSM4VEQ7DNQ .
Hello, I had a folder of .nii fmri files that I made into a gz file using 'zip fmri.nii.gz s*.nii'. The above error comes up when I run 'func = readnii("fmri.nii.gz")'. I am trying to use this as an input into the beginning of your preprocessing pipeline 'files = c(anatomical = anat, functional = func)'. I was wondering if you know of any fix to this error, or if you have any recommendations on how to input my own files to your pipeline. Thank you so much!