I am sorry: this may be a straightforward question but I can not figure out why 3dinfo is crashing with a segmentation fault.
This file is an activation map obtained by the FAST-fMRI algorithm in our R package (RFASTfMRI). What RFASTfMRI does is creates an activation map and as an array. We have multiplied the activation map with the Z map to only have the Z map wherever there is activation, it is 0 otherwise. We convert it do nifti using the R package oro.nifti.
However, I get:
$ 3dinfo -verb Bstand2-int-FAST-death-negative.nii.gz
++ 3dinfo: AFNI version=AFNI_20.1.07 (May 21 2020) [64-bit]
Fatal Signal 11 (SIGSEGV) received
THD_open_nifti
THD_open_one_dataset
THD_open_dataset
3dinfo main
Bottom of Debug Stack
** AFNI version = AFNI_20.1.07 Compile date = May 21 2020
** [[Precompiled binary linux_openmp_64: May 21 2020]]
** Program Death **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
** Crash log is appended to file .afni.crashlog
The AFNI crash log file is here:
$ m ~/.afni.crashlog
*********------ CRASH LOG ------------------------------***********
Fatal Signal 11 (SIGSEGV) received
.......... recent internal history .........................................
++3dinfo main [2]: {ENTRY (file=3dinfo.c line=340) from Bottom of Debug Stack {0
ms}
+++AFNI_process_environ [3]: {ENTRY (file=afni_environ.c line=155) from 3dinfo m
ain {0 ms}
++++AFNI_suck_file [4]: {ENTRY (file=afni_environ.c line=64) from AFNI_process_e
nviron {0 ms}
----AFNI_suck_file [4]: EXIT} (file=afni_environ.c line=84) to AFNI_process_envi
ron {0 ms}
---AFNI_process_environ [3]: EXIT} (file=afni_environ.c line=240) to 3dinfo main
{1 ms}
+++THD_open_dataset [3]: {ENTRY (file=thd_mastery.c line=31) from 3dinfo main {1
ms}
++++THD_open_one_dataset [4]: {ENTRY (file=thd_opendset.c line=149) from THD_ope
n_dataset {1 ms}
+++++THD_open_nifti [5]: {ENTRY (file=thd_niftiread.c line=49) from THD_open_one
_dataset {1 ms}
............................................................................
THD_open_nifti
THD_open_one_dataset
THD_open_dataset
3dinfo main
** AFNI compile date = May 21 2020
** [[Precompiled binary linux_openmp_64: May 21 2020]]
** Program Crash *
Now, this may not be relevant, but the oro.nifti package in R reads the file as I intend it to be:
readNIfTI(fname = "Bstand2-int-FAST-death-negative.nii.gz")
NIfTI-1 format
Type : nifti
Data Type : 16 (FLOAT32)
Bits per Pixel : 32
Slice Code : 0 (Unknown)
Intent Code : 5 (Zscore)
Qform Code : 4 (MNI_152)
Sform Code : 4 (MNI_152)
Dimension : 50 x 61 x 23
Pixel Dimension : 3.5 x 3.5 x 6
Voxel Units : mm
Time Units : Unknown
Is there something that is not right in the saving for this segmentation fault to happen?
One issue that is bothersome and may be relevant is that oro.nifti in R appears to work with NIfTI-1 format. Is this the issue?
Btw, given a 3D or 4D array, is it possible to convert it into nifti format using afni tools?
Thank you, I was putting the sform_code to be 4 (because as per the authors of the dataset, the coordinates are in MNI space).
Btw, if I save the sform and qform codes to be 0 then I do not get anything to show up at all on SUMA. However, the slices are activated, as in the attached screenshot.
Thanks very much! I had originally tried what you suggested, but my activation regions are coming to be outside the brain. This is a mismatch. (I have attached the figure.)
Here are the parameters that I used while saving (in R):
y <- nifti(x, pixdim = c(3,3.5,3.5,6), qform.code = 4, sform.code = 4, intent.code = 5, xyzt.units = c("mm", "mm", "mm"), datatype = 16)
##
## no idea why pixdim[1] = 0 and the codes do not get picked up
##
y@sform_code <- 0
y@qform_code <- 4
y@intent_code <- 5
y@pixdim[1] <- 3
y@xyzt_units <- 2 # 2 stands for mm
writeNIfTI(nim = y, file = "Bstand2-int-FAST-death-negative", verbose = TRUE)
I will put the new file up also, with a slightly different name, in case the old one gets wiped out by this upload.
Many thanks again, and I am sorry for all the trouble.
The only spatial information in this dataset is pixdim which specifies the voxel size, along with the qform_code=4 claim that the coordinates are in MNI space. But there are no actual coordinates specified (e.g. stating where 0,0,0 should actually be), and there is no orientation information (stating which direction is left vs anterior, for example). Right now, the software assumes an identity matrix, scaled by the pixdim values, but that is surely inappropriate.
If your software inputs a NIFTI dataset, it would be good to preserve all of the spatial attributes of that input when writing the output (which could include the sform again).
Thanks, very much for looking into this. I am really grateful. Unfortunately, the dataset is made available here: http://www.ccbi.cmu.edu/Suicidal-ideation-NATHUMBEH2017/Just-NatHumBeh2017-data-and-code.html
It just has the values stored as an array, and they say it is in NMI space so that is what we have proceeded with. I guess that the infomation is not enough for spatial display then. I think that the authors used SPM in their analysis/displays and I was using SUMA/AFNI.
Many thanks again, and best wishes,
Ranjan
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.