I’m relatively new to the community and am looking to streamline the mrsi pipeline for my lab. One important step for this is getting the LCModel fit results. I have been manually doing this through the lcmgui, however, it would be even faster if I can do it through the command line. However, when I began using control files to run LCModel through command lines rather than the GUI, I noticed a discrepancy between my outputs.
When I run LCModel using the command line, LCModel terminates earlier than it does with the GUI. I.e. both methods perform and get equal results from fitting the center voxels, but as the program moves onto the outer voxels the command line method terminates earlier even for my best quality data. Is there a command that I can input into my control file to prevent early termination? I’m aware that LCMGUI uses the standard execution script with the line MAX_BAD =16 to describe the end case for bad voxels, is there a way to do this within the control files for the command line input?
TLDR: How can I change my control file for LCModel use through the command line so that it can skip the same number of bad voxels as LCMGUI.
I can reply with my control files (input for command line and output from lcmgui) if they would help.
These are the three main differences between the two control files that I can spot at first glance. dows = F and doecc = F are the flags to deactivate water scaling and eddy-current correction, but I don’t see a water reference file provided (do you have one at all that you use?) anyway, so they shouldn’t matter much.
degzer = 0 might matter though (it’s a zero-order phase correction prior). I think the default for that is 0 anyway, but you never know what’s going on behind the scenes with LCModel.
edit: lcoraw = 10 is also different but I have not really used that before - see the manual at section 11.9.3.
MAX_BAD isn’t specified in the control file. Looking closely at the run script (execution-scripts/standard), it’s basically running LCModel multiple times (up to MAX_BAD times) with the same control file.
lcsi_sav isn’t documented, but appears to specify a temporary file which LCModel can use to store state between successive runs. So, it remembers how far it got before failing, and picks up on the next voxel the next time you call it.
The safest would be to use the supplied execution script (lcmodel/execution-scripts/standard), since this initialises the files correctly and handles edge cases (like failure on the first voxel) sensibly.
I suggest, for each subject:
Create a temporary folder: temp_folder=$(mktemp -d)
Copy your original control file to that folder (needs to be named, exactly, control ): cp your.control.file ${temp_folder}/control
Then run the execution script on that folder, lcmodel/execution-scripts/standard ${temp_folder}
Then, clean up the temporary folder: rm -f ${temp_folder}/{filcsi_sav_2,filcsi_sav_1,control,runtime-messages,times}; rmdir ${temp_folder}/done ${temp_folder}
Hey,
Thank you for the response. I see that the second control file doesn’t contain the dows & doecc bools, but they were set to false/not activated in the gui and I don’t have a water file for this dataset so it shouldn’t be the difference. It is there in the first file because some of my datasets contain a water reference file, so my write function writes these variables.
As for lcoraw, I excluded it from the control files that I write (vs LCMGUI) because right now I am still testing the functionality, so I am just keeping the basic output that I need. It also is unlikely to be the error because both options produce the same output for a portion of the range, e.g. from 15:40 row/col, but the command line option will terminate about 5 rows earlier (not set but dependent on data set).
You raise a good point with the zero-order prior correction. However, I’ve rerun the data with both methods excluding the variable and I still observe the same effect. I wonder if this is just something that is hard coded in the LCModel Fortran code and that is why the execution scripts were developed to modify the code.
Thanks for the suggestions, I suspected it might have something to do with myself saving directly to a different directory and bypassing the temporary folder. But as you mentioned in your last point, I’ve cleared the temporary folder before, and it can cause issues with LCModel so I figured it was best to avoid writing/reading from here. However, the reasoning is logical and would explain the difference. I will try these suggestions today after making a clone, Thanks!