Print

Print


Hi there,
I think the problem is likely that you are trying to run N4 on a 4D image
with a 3D mask. You could conceivably create a 4D mask by merging identical
copies of hifi_nodifu_brain_mask to reflect the number of volumes in
your eddy_corrected_dataup file and it will work. However, I don't really
know how much sense it makes to try to bias field correct your 4D diffusion
images to begin with. What was the rationale for N4'ing the eddy output?

On Mon, Sep 3, 2018 at 6:02 PM, Mahmoud <[log in to unmask]> wrote:

> Hi Niels,
>
> Here are the outputs:
>
> filename       eddy_corrected_dataup.nii.gz
>
> sizeof_hdr     348
> data_type      FLOAT32
> dim0           4
> dim1           92
> dim2           92
> dim3           56
> dim4           67
> dim5           1
> dim6           1
> dim7           1
> vox_units      mm
> time_units     s
> datatype       16
> nbyper         4
> bitpix         32
> pixdim0        0.000000
> pixdim1        2.000000
> pixdim2        2.000000
> pixdim3        2.000000
> pixdim4        1.000000
> pixdim5        0.000000
> pixdim6        0.000000
> pixdim7        0.000000
> vox_offset     352
> cal_max        0.0000
> cal_min        0.0000
> scl_slope      1.000000
> scl_inter      0.000000
> phase_dim      0
> freq_dim       0
> slice_dim      0
> slice_name     Unknown
> slice_code     0
> slice_start    0
> slice_end      0
> slice_duration 0.000000
> time_offset    0.000000
> intent         Unknown
> intent_code    0
> intent_name
> intent_p1      0.000000
> intent_p2      0.000000
> intent_p3      0.000000
> qform_name     Scanner Anat
> qform_code     1
> qto_xyz:1      -1.992691  -0.170833  0.000004  98.968330
> qto_xyz:2      -0.165615  1.931805  -0.490615  -72.178741
> qto_xyz:3      -0.041903  0.488822  1.938891  -49.519180
> qto_xyz:4      0.000000  0.000000  0.000000  1.000000
> qform_xorient  Right-to-Left
> qform_yorient  Posterior-to-Anterior
> qform_zorient  Inferior-to-Superior
> sform_name     Scanner Anat
> sform_code     1
> sto_xyz:1      -1.992691  -0.170834  -0.000000  98.968330
> sto_xyz:2      -0.165614  1.931805  -0.490615  -72.178741
> sto_xyz:3      -0.041907  0.488822  1.938891  -49.519180
> sto_xyz:4      0.000000  0.000000  0.000000  1.000000
> sform_xorient  Right-to-Left
> sform_yorient  Posterior-to-Anterior
> sform_zorient  Inferior-to-Superior
> file_type      NIFTI-1+
> file_code      1
> descrip        5.0.11
> aux_file
>
> filename       hifi_nodifupdn_brain_mask.nii.gz
>
> sizeof_hdr     348
> data_type      FLOAT32
> dim0           3
> dim1           92
> dim2           92
> dim3           56
> dim4           1
> dim5           1
> dim6           1
> dim7           1
> vox_units      mm
> time_units     s
> datatype       16
> nbyper         4
> bitpix         32
> pixdim0        0.000000
> pixdim1        2.000000
> pixdim2        2.000000
> pixdim3        2.000000
> pixdim4        1.000000
> pixdim5        0.000000
> pixdim6        0.000000
> pixdim7        0.000000
> vox_offset     352
> cal_max        0.0000
> cal_min        0.0000
> scl_slope      1.000000
> scl_inter      0.000000
> phase_dim      0
> freq_dim       0
> slice_dim      0
> slice_name     Unknown
> slice_code     0
> slice_start    0
> slice_end      0
> slice_duration 0.000000
> time_offset    0.000000
> intent         Unknown
> intent_code    0
> intent_name
> intent_p1      0.000000
> intent_p2      0.000000
> intent_p3      0.000000
> qform_name     Scanner Anat
> qform_code     1
> qto_xyz:1      -1.992691  -0.170833  0.000004  98.968330
> qto_xyz:2      -0.165615  1.931805  -0.490615  -72.178741
> qto_xyz:3      -0.041903  0.488822  1.938891  -49.519180
> qto_xyz:4      0.000000  0.000000  0.000000  1.000000
> qform_xorient  Right-to-Left
> qform_yorient  Posterior-to-Anterior
> qform_zorient  Inferior-to-Superior
> sform_name     Scanner Anat
> sform_code     1
> sto_xyz:1      -1.992691  -0.170833  0.000004  98.968330
> sto_xyz:2      -0.165615  1.931805  -0.490615  -72.178741
> sto_xyz:3      -0.041903  0.488822  1.938891  -49.519180
> sto_xyz:4      0.000000  0.000000  0.000000  1.000000
> sform_xorient  Right-to-Left
> sform_yorient  Posterior-to-Anterior
> sform_zorient  Inferior-to-Superior
> file_type      NIFTI-1+
> file_code      1
> descrip        5.0.11
> aux_file
>
> and this is after applying the fslcpgeom:
>
> filename       hifi_nodifupdn_brain_mask.nii.gz
>
> sizeof_hdr     348
> data_type      FLOAT32
> dim0           3
> dim1           92
> dim2           92
> dim3           56
> dim4           1
> dim5           1
> dim6           1
> dim7           1
> vox_units      mm
> time_units     s
> datatype       16
> nbyper         4
> bitpix         32
> pixdim0        0.000000
> pixdim1        2.000000
> pixdim2        2.000000
> pixdim3        2.000000
> pixdim4        1.000000
> pixdim5        0.000000
> pixdim6        0.000000
> pixdim7        0.000000
> vox_offset     352
> cal_max        0.0000
> cal_min        0.0000
> scl_slope      1.000000
> scl_inter      0.000000
> phase_dim      0
> freq_dim       0
> slice_dim      0
> slice_name     Unknown
> slice_code     0
> slice_start    0
> slice_end      0
> slice_duration 0.000000
> time_offset    0.000000
> intent         Unknown
> intent_code    0
> intent_name
> intent_p1      0.000000
> intent_p2      0.000000
> intent_p3      0.000000
> qform_name     Scanner Anat
> qform_code     1
> qto_xyz:1      -1.992691  -0.170833  0.000004  98.968330
> qto_xyz:2      -0.165615  1.931805  -0.490615  -72.178741
> qto_xyz:3      -0.041903  0.488822  1.938891  -49.519180
> qto_xyz:4      0.000000  0.000000  0.000000  1.000000
> qform_xorient  Right-to-Left
> qform_yorient  Posterior-to-Anterior
> qform_zorient  Inferior-to-Superior
> sform_name     Scanner Anat
> sform_code     1
> sto_xyz:1      -1.992691  -0.170834  -0.000000  98.968330
> sto_xyz:2      -0.165614  1.931805  -0.490615  -72.178741
> sto_xyz:3      -0.041907  0.488822  1.938891  -49.519180
> sto_xyz:4      0.000000  0.000000  0.000000  1.000000
> sform_xorient  Right-to-Left
> sform_yorient  Posterior-to-Anterior
> sform_zorient  Inferior-to-Superior
> file_type      NIFTI-1+
> file_code      1
> descrip        5.0.11
> aux_file
>
>
> On Mon, Sep 3, 2018 at 11:45 AM Niels Bergsland <[log in to unmask]>
> wrote:
>
>> Hi there,
>> Might help to post the output of fslhd for hifi_nodifu_brain_mask and
>> eddy_corrected.
>>
>> On Mon, Sep 3, 2018 at 5:32 PM, Mahmoud <[log in to unmask]> wrote:
>>
>>> Hi Paul,
>>>
>>> Thanks for your reply. Actually, I used fslcpgeom and the sets of
>>> commands below:
>>> fslorient -getsform eddy_corrected.nii.gz > sform
>>> fslorient -getqform eddy_corrected.nii.gz > qform
>>> fslorient -setsform `cat sform` hifi_nodif_brain_mask.nii.gz
>>> fslorient -setqform `cat qform` hifi_nodif_brain_mask.nii.gz
>>>
>>> but I'm still getting the same exact error!
>>>
>>> *N4BiasFieldCorrection -d 3 -x ./hifi_nodifu_brain_mask.nii.gz -i
>>> ./eddy_corrected.nii.gz -o ./test1.nii.gz -v*
>>>
>>> *Running N4 for 3-dimensional images.*
>>>
>>> *Exception caught:*
>>> *itk::ExceptionObject (0x2852da0)*
>>> *Location: "unknown"*
>>> *File:
>>> /data1/lib/build/ANTS/CentOS7/antsbin/ITKv5-install/include/ITK-5.0/itkImageToImageFilter.hxx*
>>> *Line: 240*
>>> *Description: itk::ERROR: N4BiasFieldCorrectionImageFilter(0x28444f0):
>>> Inputs do not occupy the same physical space!*
>>> *InputImage Origin: [-9.5968330e+01, 7.5178741e+01, -4.6519180e+01],
>>> InputImage_1 Origin: [-9.5723050e+01, 7.0265378e+01, -4.5940466e+01]*
>>> *        Tolerance: 8.0000000e-06*
>>> *InputImage Direction: 1.0000000e+00 0.0000000e+00 0.0000000e+00*
>>> *0.0000000e+00 1.0000000e+00 0.0000000e+00*
>>> *0.0000000e+00 0.0000000e+00 1.0000000e+00*
>>> *, InputImage_1 Direction: 9.9634532e-01 8.5416688e-02 -1.9561758e-06*
>>> *8.2807286e-02 -9.6590231e-01 2.4530730e-01*
>>> *-2.0951447e-02 2.4441094e-01 9.6944537e-01*
>>>
>>> *        Tolerance: 1.0000000e-06*
>>>
>>> So, I'm confused what could be the cause of this error.
>>>
>>> Thanks,
>>> Mahmoud
>>>
>>>
>>> On Mon, Sep 3, 2018 at 11:21 AM paul mccarthy <[log in to unmask]>
>>> wrote:
>>>
>>>> Hi Mahmoud,
>>>>
>>>> You can use the fslcpgeom command to copy the geometry information
>>>> from one image to another.
>>>>
>>>> Cheers,
>>>>
>>>> Paul
>>>>
>>>> On 3 September 2018 at 16:13, / Mahmoud/ <[log in to unmask]> wrote:
>>>>
>>>>> Hello all,
>>>>>
>>>>> I 'm using both FSL and ANTs for processing our DWI data.
>>>>> I ran into a problem arising from the fact that FSL and ANTs handle
>>>>> the image headers differently. At least that's my guess. I tried to figure
>>>>> it out at the ANTs side but couldn't find a solution.
>>>>>
>>>>> The problem is that N4Biascorrection (from ANTs) fails when I try to
>>>>> add the mask option to it and what it says is that basically, something in
>>>>> the header of the input file is not matching the mask file: " Description:
>>>>> itk::ERROR: N4BiasFieldCorrectionImageFilter(0x2fdc4f0): Inputs do
>>>>> not occupy the same physical space!"
>>>>>
>>>>> I compared the headers of the input and mask images and found that
>>>>> other than the number of volumes,  the sto_xyz_matrix and sto_ijk_matrix do
>>>>> not match.
>>>>>
>>>>> So, how can I match these two headers in the fields that I want?
>>>>> I tried to do it manually using the fsledithd but that did not work.
>>>>>
>>>>> Thanks for your help!
>>>>> Mahmoud
>>>>>
>>>>> ############################################################
>>>>> ############
>>>>>
>>>>> To unsubscribe from the FSL list, click the following link:
>>>>> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
>>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>
>>>> To unsubscribe from the FSL list, click the following link:
>>>> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
>>>>
>>>
>>> ------------------------------
>>>
>>> To unsubscribe from the FSL list, click the following link:
>>> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
>>>
>>
>>
>>
>> --
>> Niels Bergsland
>> Integration Director / Research Assistant Professor of Neurology
>> Buffalo Neuroimaging Analysis Center / University at Buffalo
>> 100 High St. Buffalo NY 14203
>> <https://maps.google.com/?q=100+High+St.+Buffalo+NY+14203&entry=gmail&source=g>
>> [log in to unmask]
>>
>> ------------------------------
>>
>> To unsubscribe from the FSL list, click the following link:
>> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
>>
>
> ------------------------------
>
> To unsubscribe from the FSL list, click the following link:
> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1
>



-- 
Niels Bergsland
Integration Director / Research Assistant Professor of Neurology
Buffalo Neuroimaging Analysis Center / University at Buffalo
100 High St. Buffalo NY 14203
[log in to unmask]

########################################################################

To unsubscribe from the FSL list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=FSL&A=1