kschan0214 / sepia

Matlab GUI pipeline application for quantitative susceptibility mapping (QSM)
MIT License
46 stars 10 forks source link

(v0.8.1)Errors occured with same steps in v0.8.0. #14

Closed zoelir729 closed 2 years ago

zoelir729 commented 3 years ago

Sorry to bother! I have met a problem in using v0.8.1. Picture 1 showed the steps I chose in v0.8.0, processing pipeline could completed, and I chose the same options in v0.8.1, but errors occured (picture 2).

image

image

kschan0214 commented 3 years ago

Hi Zoe, the error comes from the mismatch between the length of the echo times (TE) and the time dimension (4th) of the magnitude data. These two pieces of information have to be consistent for a few steps required in SEPIA QSM processing. Can you check if the number of the elements in the parameter 'TE' in the sepia_head.mat file have the same number of time series images in the magnitude and phase data and report back?

zoelir729 commented 3 years ago

I checked the data, the number of the elements in the parameter 'TE' in the sepia_head.mat file (TE=0.0236) indeed did not have the same number of time series images in the magnitude and phase data (both TE=24). How to deal with this issue? image image

kschan0214 commented 3 years ago

The most straightforward way is to modify the sepia_header.mat file by manually overwriting all the echo times (in second): e.g. in the Matlab command window:

clear all;
load('sepia_header.mat');
TE = [TE1,TE2,TE3,....,TE24]; % where TE1, TE2, TE3... are the echo times of each echo in the unit of second
delta_TE = TE2 - TE1;
save('sepia_header.mat');

Alternatively, if you have the JSON file(s) that contains all echo time information of the data (available if using dcm2niix or dicm2nii DICOM to NIFTI conversion tools), you can use these file as the input in the 'Get header info' function. The SEPIA should be able to read all the echo times in the files.

Screenshot 2021-04-23 at 14 14 23

Let please me know if this works for you.

zoelir729 commented 3 years ago

Actually, the sepia_header.mat file I used was obtained using 'Get header info' function of the SEPIA. The processing pipeline did not work successfully in v 8.0.1 but well in v 0.8.0.

kschan0214 commented 3 years ago

In v0.8.1 we added several procedures to make sure the input data (header and images) are consistent. The issue you encountered is one of those, which indicates there are some TE information missing in the header.

If you already used the 'Get header info' function, it is likely the JSON file does not contain all the echo times of the acquisition. This can be checked by looking up the 'EchoTime' or 'EchoTimes' tag in the file. If there is only 1 value instead of all the echoes, then the TE information is not complete. This could happen if you use dcm2niix to convert the data from DICOM to NIFTI format with the 'merge' option as 'yes' (more explanation here: https://sepia-documentation.readthedocs.io/en/latest/getting_started/Data-preparation.html). On the other hand, if you have separate JSON files for each echo, you will then need to select all JSON files when selecting the TE files.

If the JSON file(s) doesn't have the complete TE information, you can manually overwrite it in the GUI, e.g.: Screenshot 2021-04-24 at 10 57 03

kschan0214 commented 3 years ago

Hi Zoe,

I would like to follow up your issue. Is it being solved?

If not, would you mind clarifying that whether you are running on multi-echo data or single echo data? It seems that you are running on a single-echo dataset based on the header but I might misunderstand that you are running on a multi-echo dataset. If you are working on single echo data, can you update SEPIA to the current 'master' branch and test on your dataset again?

Best,

Kwok

zoelir729 commented 3 years ago

Sorry to reply for a long time! Indeed the data I used was single echo data. Now I have updated SEPIA to the current v 0.8.1.1. However, another error occurred. image And the version sepia-0.8.0 could still work without errors reports. Hope you can offer some suggestions. Thanks!

Best, Zoe

kschan0214 commented 2 years ago

Hi Zoe, this is something new to me. I haven't countered this problem before. It seems that Matlab cannot see the automatically generated pipeline config file ('sepia_config_5.m'). This is a bit unusual because the 'configFilename' variable should contain the full path of the file.

Can you check and let me know if the Matlab script file 'sepia_config_5.m' was generated in the output directory you specified in the 'Output prefix' field in the GUI? If possible, can you also attach the full texts in the 'Output prefix' field?

zoelir729 commented 2 years ago

The error had been fixed. (some unexpected mismatched metadata was found finally.) Thank you for your reply and recommendation. And at present, another issue puzzled me. I will open a new issue. Hope you can give me some instructions.