dark spots on undistorted data


I’m trying running distortion correction on an oblique functional dataset of 54 slices through Matlab 2019a.
Everything seemed to work until I found out some black spots on the undistorted data.

These are the commands I use - and please find attached an example picture of the problem

  • to convert dicom in afni readable nifti
    dcm_to_nii_command = sprintf(“Dimon -infile_prefix ‘%s/*.dcm’ -use_obl_origin -gert_create_dataset -gert_write_as_nifti -gert_outdir %s -gert_to3d_prefix %s”, input_directory_path, …
    output_filepath, …

  • to perform the distortion correction
    warp_command = sprintf(“3dQwarp -plusminus -pmNames reverse forward -source %s -base %s -prefix %s_warp.nii”, inv_sbref_path, …
    sbref_path, …

mb_appy_warp_command = sprintf(“3dNwarpApply -quintic -nwarp %s_warp_forward_WARP.nii -source %s -prefix %s”, bids_id, …
mb_path, …

sbref_apply_warp_command = sprintf(“3dNwarpApply -quintic -nwarp %s_warp_forward_WARP.nii -source %s -prefix %s”, bids_id, …
sbref_path, …

So when I run this it suggests me to consider to3D -ushort2float. I tried but it seems I’m not allow to do it, and the commans is just ignored.
Any help?


Hi Cecilia,

For there to be an integer wrap-around problem, the holes would tend to be in bright areas. While the hole on the right side (about the size of the crosshair hole) seems like it could be from that, the others do not so much. But that is just a little eyeball test.

At any rate, you should be able to add -ushort2float to the initial Dimon command (it would then apply it in the subsequent to3d command used to create the datasets). It would be good to see what difference that makes.

  • rick

HI Rick,

thanks a lot for your help. I have now run the following

dcm_to_nii_command = sprintf(“Dimon -infile_prefix ‘%s/*.dcm’ -ushort2float -use_obl_origin -gert_create_dataset -gert_write_as_nifti -gert_outdir %s -gert_to3d_prefix %s”, input_directory_path, …
output_filepath, …

however, I can see from the command window that is not doing what I want…please see screenshot attached
Also, I get the some dark spots in random places, sometimes in the middle of the brain, sometimes just outside


Some of those dark spots seemed like common dropout.

For the to3d command, it looks like it suggests -ushort2float even if the option is being applied, which is confusing. The message admits to not knowing. I will take a look at why…

For comparison, try running dcm2niix (or dcm2niix_afni) and seeing what it produces. It will tend to reorient the data to RPI order but you can still compare with the Dimon/to3d output.

  • rick

I think I might have generated some confusion: I get the dark spots after the distortion correction, before that the nifti file is fine. Also, if I import the dicom files in BV and open them, I can’t see any signal dropout.
I will try now to use dcm2niix and let you know.


Oh, that is very peculiar. Can you verify exactly which command is causing them to appear?

And for both the input to and output from that command, would you please run both of these commands?

3dinfo -datum DATASET
3dBrickStat -slow -min -max DATASET


  • rick

Hey Rick,

I have run 3dQwarp and then 3dNwarpApply just for the SBref and still I get the dark spots, so I guess it might have something to do with applynf the vdm?
please find attached a screenshot of the commands you asked me


oh, the 3dinfo datum output was float both before and after