spinicist / QUIT

A set of tools for processing Quantitative MR Images
Mozilla Public License 2.0
58 stars 20 forks source link

Issues producing f0 map #19

Closed brycegeeraert closed 5 years ago

brycegeeraert commented 5 years ago

Hi,

I'm just starting to take advantage of this toolbox to for mcDESPOT processing. I am working through the example script and steps are going well until I reach "processing FM", where qidespot2fm is used to produce an f0 map. When this step runs, I receive the following output and error (output start and end marked by asterisks):


Processing FM Starting qidespot2fm v2.0.2-dirty Reading T1 Map from: D1_T1.nii Opening SSFP file: /Users/Bryce/MRI_Data/Images/18013/mcDESPOT_QUIT/QUIT_HIFI/multiflipSSFP_tr_8fa60_bothPhases_mcf.nii libc++abi.dylib: terminating with uncaught exception of type cereal::RapidJSONException: rapidjson internal assertion failure: IsObject() ./qi_example_mcd_hifi_BG.sh: line 109: 7041 Abort trap: 6 qidespot2fm -v --asym -m $MASK_FILE -b POLY_B1.nii D1_T1.nii $SSFP_MCF $NTHREADS <<END_FM $SSFP_SEQ END_FM


I am not familiar with scripting in bash, so it's difficult for me to troubleshoot this error. Is anyone able to help here? Perhaps I have set some variables wrong... Where do I start when troubleshooting this issue?

Thanks,

Bryce Geeraert

spinicist commented 5 years ago

Hello Bryce,

There was a missing pair of {} in the qi_example_mcd_hifi.sh script, it needs to be:

qidespot2fm -v --asym -m $MASK_FILE -b POLY_B1.nii D1_T1.nii $SSFP_MCF $NTHREADS <<END_FM
{
    $SSFP_SEQ
}
END_FM

I've pushed this update to master. Apologies for this, the example scripts pre-date the swap to JSON, and it turns out I missed updating the syntax in several places. The documentation explains the command-line structure much better (https://quit.readthedocs.io/en/latest/Docs/Relaxometry.html#qidespot2fm). The .bats files in the Test/ directory are mostly BASH, so you can look there for examples as well.

Finally, I am working on an nipype interface which is currently in the nipype2-merge branch, but that's not finished yet.

brycegeeraert commented 5 years ago

Hello,

Thank you for the prompt assistance. I've implemented the newly pushed code and re-ran the qi_example_mcd_hifi.sh script, but ran into a new error upon execution of qimcdespot. Here's the error below:


Finished all splits Elapsed time was 1325.41s Writing results files. Flag could not be matched: bounds qimcdespot {OPTIONS} [INPUT FILES...]

Calculates MWF & other parameter maps from mcDESPOT data
All times (e.g. T1, TR) are in SECONDS. All angles are in degrees.
http://github.com/spinicist/QUIT

OPTIONS:

  INPUT FILES...                    Input image files
  -h, --help                        Show this help message
  -v, --verbose                     Print more information
  -T[THREADS], --threads=[THREADS]  Use N threads (default=4, 0=hardware
                                    limit)
  -o[OUTPREFIX], --out=[OUTPREFIX]  Add a prefix to output filenames
  -f[f0], --f0=[f0]                 f0 map (Hertz)
  -b[B1], --B1=[B1]                 B1 map (ratio)
  -m[MASK], --mask=[MASK]           Only process voxels within the mask
  -s[SUBREGION],
  --subregion=[SUBREGION]           Process subregion starting at voxel
                                    I,J,K with size SI,SJ,SK
  -r, --resids                      Write out residuals for each data-point
  -M[MODEL], --model=[MODEL]        Select model to fit -
                                    1/2/2nex/3/3_f0/3nex, default 3
  -S, --scale                       Normalize signals to mean (a good idea)
  -a[ALGO], --algo=[ALGO]           Select (S)tochastic or (G)aussian Region
                                    Contraction
  -i[ITERS], --its=[ITERS]          Max iterations, default 4
  -t[FIELD STRENGTH],
  --tesla=[FIELD STRENGTH]          Specify field-strength for fitting
                                    regions - 3/7/u for user input
  "--" can be used to terminate flag options and force all following
  arguments to be treated as positional options

I didn't find a purpose for the --bounds flag while quickly troubleshooting, so I removed the option and re-ran the script from the beginning, only to run into a new error, included below:


Finished all splits Elapsed time was 1155.63s Writing results files. Starting qimcdespot v2.0.2-dirty Reading file: /Users/Bryce/MRI_Data/Images/18013/mcDESPOT_QUIT/QUIT_HIFI/multiflipSPGR_tr_8fa18.nii Reading file: /Users/Bryce/MRI_Data/Images/18013/mcDESPOT_QUIT/QUIT_HIFI/multiflipSSFP_tr_8fa60_bothPhases.nii libc++abi.dylib: terminating with uncaught exception of type cereal::Exception: JSON Parsing failed - provided NVP (SequenceGroup) not found /Users/Bryce/bin/quit/Scripts/qi_example_mcd_hifi_BG_new.sh: line 122: 34532 Abort trap: 6 qimcdespot -v -m $MASK_FILE -f FM_f0.nii -b POLY_B1.nii -M2 -S $SPGR_FILE $SSFP_FILE $NTHREADS <<END_MCD { "Sequences": [ { $SPGR_SEQ }, { $SSFP_SEQ } ] } END_MCD


I'm hoping I can get some insight into what might be causing these errors. If it helps, I'm happy to provide the full output of the script as it runs. Any input will be greatly appreciated! I'll continue to troubleshoot the qimcdespot function tomorrow to see if I can't find a way to get the process running.

Best wishes,

Bryce

spinicist commented 5 years ago

Hi,

Did you compile QUIT yourself or are you using the pre-compiled binaries? I'm pretty sure it's the latter, which are out of date at this point. I am waiting for ITK to officially release ITK 5 (they are currently at beta 2) before making a new release of QUIT.

If you are not able to compile yourself, then you should be able to get it to run by adding an enclosing "SequenceGroup" JSON object - see the version of the script that comes with v2.0.2 (https://github.com/spinicist/QUIT/blob/v2.0.2/Scripts/qi_example_mcd_b1.sh).

The current QUIT code has much improved error messages over v2.0.2.

brycegeeraert commented 5 years ago

Thank you for your continued correspondence. Adding the enclosing "SequenceGroup" JSON object didn't resolve the issue. Using the following syntax qimcdespot now terminates right away with the following error:


qimcdespot -v -m $MASK_FILE -f FM_f0.nii -b POLY_B1.nii -M2 -S $SPGR_FILE $SSFP_FILE $NTHREADS <<END_MCD { "SequenceGroup": { "Sequences": [ { $SPGR_SEQ }, { $SSFP_SEQ } ] } } END_MCD



Starting qimcdespot v2.0.2-dirty Reading file: /Users/Bryce/MRI_Data/Images/18013/mcDESPOT_QUIT/QUIT_Jan2019/multiflipSPGR_tr_8fa18.nii Reading file: /Users/Bryce/MRI_Data/Images/18013/mcDESPOT_QUIT/QUIT_Jan2019/multiflipSSFP_tr_8fa60_bothPhases.nii libc++abi.dylib: terminating with uncaught exception of type cereal::Exception: JSON Parsing failed - provided NVP (sequences) not found ./qi_example_mcd_hifi_BG_new_justMCD.sh: line 124: 2478 Abort trap: 6 qimcdespot -v -m $MASK_FILE -f FM_f0.nii -b POLY_B1.nii -M2 -S $SPGR_FILE $SSFP_FILE $NTHREADS <<END_MCD { "SequenceGroup": { "Sequences": [ { $SPGR_SEQ }, { $SSFP_SEQ } ] } } END_MCD


Again, I am sure my lack of experience in bash and java is the limiting factor, here. If I can find a way to run this on my system, fantastic.

Thank you!

Bryce Geeraert

spinicist commented 5 years ago

Hello,

"Sequences" should be "sequences", note the lower case s at the start. I'm sure we can get it working for you - the fact that DESPOT1 and DESPOT2-FM finish is a very good sign. Do the output maps for those look plausible?

(Please excuse some mild pedantry - this isn't Java, it's Java Script Object Notation which is read by a C++ program)

brycegeeraert commented 5 years ago

My apologies for mis-labeling JSON. My lack of experience with anything other than basic Python scripting and Matlab shows!

Sequences -> sequences has resolved the issue, qimcdespot ran smoothly and the output maps look reasonable! Thank you very much for your continued support.

I've got one more question to ask, with regards to scan parameters in this example script. I've got most of these correct for my dataset, but would like some clarification on the MPRAGE_SEQ parameters. Specifically, ETL, k0, TD and eta. My understanding is ETL would be echo train length, and TD would be time between the echo train termination and next inversion, is that correct? I'm not familiar with k0 and eta, though. Can you clarify these parameters?

Thanks again!

spinicist commented 5 years ago

That's great news!

An explanation of those parameters is here: https://quit.readthedocs.io/en/latest/Docs/Relaxometry.html#qidespot1hifi. You are correct about ETL and TD. What scanner manufacturer are you using?

brycegeeraert commented 5 years ago

Thank you for the link, I had missed this description of the parameters as I had only looked through the qimcdespot documentation. This documentation has cleared up any confusion that I've got! I've used the package to process a few of my datasets and things are looking quite good so far. Thank you for all the help!

And, to answer your question, I am using a GE scanner to collect my data.

spinicist commented 5 years ago

We are also on GE here. If you ever want scanner specific help or anything else, don't hesitate to e-mail me on my uni account which is in the README.md file.