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

Detect bogus BrainVoyager NIfTI headers #36

Open
neurolabusc opened this issue Mar 13, 2023 · 3 comments
Open

Detect bogus BrainVoyager NIfTI headers #36

neurolabusc opened this issue Mar 13, 2023 · 3 comments

Comments

@neurolabusc
Copy link

The NIfTI specification defines cal_min and cal_max as follows:

float cal_max;       /*!< Max display intensity */  /* float cal_max;       */
float cal_min;       /*!< Min display intensity */  /* float cal_min;       */

It is standard convention to set both to zero if they are to be ignored. Unfortunately, BrainVoyager seems to set these to 0 and 255 respectively when creating NIfTI data.

The BIDS format BrainVoyager Getting Started Guide (GSG) files exhibit this, e.g. GSGData.zip. Consider the fMRI image that has a mean intensity of 4022 (with a range of 0..49183). Here the cal_min and cal_max of 0..255 is inappropriate, with even dark air voxels having values ~700.

$ fslinfo sub-01_ses-04_task-blocked_run-1_bold.nii.gz   
data_type	FLOAT32
dim1		100
dim2		100
dim3		64
dim4		291
datatype	16
pixdim1		2.000000
pixdim2		2.000000
pixdim3		2.000000
pixdim4		2.000000
cal_max		255.000000
cal_min		0.000000
file_type	NIFTI-1+
$ fslstats sub-01_ses-04_task-blocked_run-1_bold.nii.gz -m -R
4021.941837 0.000000 49183.000000 

It would be great if BrainVoyager could fix this, but bvlabel could also provide a mechanism for detecting and fixing existing bogus values.

@ofgulban
Copy link
Owner

ofgulban commented Mar 13, 2023

@neurolabusc thanks a lot for opening this issue and informing us. I will submit this as a bug to brainvoyager.

Just to double check if I understand correctly, here you are talking about a file (probably a .fmr) that is exported from BrainVoyager as nifti (using the GUI export nifti option), right?

@ofgulban
Copy link
Owner

ofgulban commented Mar 13, 2023

Tagging @ju-ec and @nausikaa8 , because this might be something to consider while updating the docs and example data.

@nausikaa8
Copy link
Contributor

Thanks @ofgulban, we have updated the tests.

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

3 participants