Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (any(bad_pixdim)) { : missing value where TRUE/FALSE needed #4

Closed
rudolph-the-red-nose-reindeer opened this issue Dec 21, 2020 · 5 comments

Comments

@rudolph-the-red-nose-reindeer

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!

@muschellij2
Copy link
Owner

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.

@rudolph-the-red-nose-reindeer
Copy link
Author

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)

@muschellij2
Copy link
Owner

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.

@rudolph-the-red-nose-reindeer
Copy link
Author

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!

@muschellij2
Copy link
Owner

muschellij2 commented Dec 21, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants