aacache, toolboxes - #213
Conversation
Dealing with multiple fieldmaps
|
FieldTrip has a nasty problem of shadowing functions in the Matlab signal processing toolbox (cf. ./spm12/external/fieldtrip/external/signal) and some of their versions are inconsistent with the Mathworks implementation. (I've actually removed FieldTrip from my SPM install because of this). Just curious: would your Toolbox fix change this behavior? M |
|
The solution is that you can load an unload toolboxes (such as FieldTrip) from the path easily. Apart from SPM, the other toolboxes are not pre-loaded (i.e. not added to the path during aa_init), but they are rather loaded and unloaded within the modules if needed. |
support pre-loaded cell of fmap header in aamod_fieldmap2VDM
|
Happy to combine this with some work on my fork and run the test suite, once we have clarity on #214. |
|
Ok, I've dropped MPM. Now crashing on fieldmap2vdm: |
|
I think I was last to touch aamod_fieldmap2VDM (jooh#3) but not sure what the problem would be without looking. In that PR I tried resolving cases where fieldmap te's were within a cell (i.e. tes = FM_DICOMHEADERS.dcmhdr{1,1})
…________________________________
From: Johan Carlin <[email protected]>
Sent: 14 July 2020 14:57
To: automaticanalysis/automaticanalysis <[email protected]>
Cc: Ethan Knights <[email protected]>; Mention <[email protected]>
Subject: Re: [automaticanalysis/automaticanalysis] aacache, toolboxes (#213)
Ok, I've dropped MPM. Now crashing on fieldmap2vdm:
MODULE aamod_fieldmap2VDM RUNNING: Create VDMs in fieldmaps for /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_00001/CBU090973/Loc
Loaded datecheck was d2+E6JDeV1oRt4x4QIbs3Q== and calc d2+E6JDeV1oRt4x4QIbs3Q==
Loaded datecheck was p75ermqZkFxi/uWnGtdK9w== and calc p75ermqZkFxi/uWnGtdK9w==
Loaded datecheck was 6024EQNM9k5aktKcxl5O/Q== and calc 6024EQNM9k5aktKcxl5O/Q==
Loaded datecheck was InZI+fz2+Ola6Q5CKPaGaA== and calc InZI+fz2+Ola6Q5CKPaGaA==
retrieve stream epi [checksum match, not recopied] from /imaging/jc01/aa/aa_demo/fmri/aamod_convert_epis_00001/CBU090973/Loc to /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_0000
1/CBU090973/Loc
retrieve stream epi_dicom_header [checksum match, not recopied] from /imaging/jc01/aa/aa_demo/fmri/aamod_convert_epis_00001/CBU090973/Loc to /imaging/jc01/aa/aa_demo/fmri/aamod_fiel
dmap2VDM_00001/CBU090973/Loc
retrieve stream fieldmap [checksum match, not recopied] from /imaging/jc01/aa/aa_demo/fmri/aamod_convert_fieldmaps_00001/CBU090973/Loc to /imaging/jc01/aa/aa_demo/fmri/aamod_fieldma
p2VDM_00001/CBU090973/Loc
retrieve stream fieldmap_dicom_header [checksum match, not recopied] from /imaging/jc01/aa/aa_demo/fmri/aamod_convert_fieldmaps_00001/CBU090973/Loc to /imaging/jc01/aa/aa_demo/fmri/
aamod_fieldmap2VDM_00001/CBU090973/Loc
executing
Load stream from file /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_00001/CBU090973/Loc/stream_fieldmap_inputto_aamod_fieldmap2VDM_00001.txt...
Load stream from file /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_00001/CBU090973/Loc/stream_epi_inputto_aamod_fieldmap2VDM_00001.txt...
Load stream from file /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_00001/CBU090973/Loc/stream_epi_dicom_header_inputto_aamod_fieldmap2VDM_00001.txt...
Load stream from file /imaging/jc01/aa/aa_demo/fmri/aamod_fieldmap2VDM_00001/CBU090973/Loc/stream_fieldmap_dicom_header_inputto_aamod_fieldmap2VDM_00001.txt...
WARNING: Error during retrieving Fieldmap Echo Times: Reference to non-existent field 'EchoTime1'.
WARNING: Manual settings are used: ms and
**** automatic analysis failed - see reason and line numbers below
ERROR: No value is specified
for help, see the <a href="https://github.com/rhodricusack/automaticanalysis/wiki">aa wiki</a>
Error using aas_log (line 65)
aa error:
see above (or set aap.options.verbose
Error in aamod_fieldmap2VDM (line 88)
if isempty(job.defaults.defaultsval.et), aas_log(aap,true,'ERROR: No value is specified'); end
Error in aa_feval (line 15)
[varargout{:}]=feval(funcname,varargin{:});
Error in aa_feval_withindices (line 4)
[aap,resp]=aa_feval(mfile_alias,aap,task,ci{:});
Error in aa_doprocessing_onetask (line 189)
[aap,resp]=aa_feval_withindices(mfile_alias,aap,task,indices);
Error in aaq_qsub_debug (line 42)
aa_doprocessing_onetask(obj.pool.Jobs(eii).Tasks.InputArguments{:})
65 error('aa:internal','aa error:\n%s\n','see above (or set aap.options.verbose')
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#213 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIFBPBRHUECAFCYDYJGGIKTR3RP5DANCNFSM4MYCRSQA>.
|
|
Thanks, @ethanknights. It was indeed the issue. I have corrected it. |
|
Hm, now crashing in aa_user_ASL on seemingly a much more fundamental problem with how toolboxes are coded in the defaults XML. Note that in the CBU defaults we have multiple toolbox entries, which does not seem to play nicely with validatepaths - it looks like mystruct.(fs{f}) should also be indexed by structind? |
|
This crash happens before the pipeline runs, so I don't think you'll get the right answer by looking at those old outputs. I made another attempt. First I double-checked that I'm on the the latest version of the PR, and attempted to re-generate the user parameters XML. I get the following exception during the creation of the new XML (this is after selecting aap_parameters_defaults_CBSU.xml in the GUI). The exception is different, but notice that the problem seems to be handling a struct array with multiple elements again. aa_user_ASL
Please wait a moment, adding <a href = "matlab: cd /home/jc01/matlab/aa5"></a> to the path
Welcome to aa version 5.4.0 (2f06ec377301b1446516ff7b0fdae55a80847e7a) Jul 2020
If you publish work that has used aa, please cite our manuscript:
<a href = "http://dx.doi.org/10.3389/fninf.2014.00090">Cusack R, Vicente-Grabovetsky A, Mitchell DJ, Wild CJ, Auer T, Linke AC, Peelle JE (2015)</a>
<a href = "http://dx.doi.org/10.3389/fninf.2014.00090">Automatic analysis (aa): Efficient neuroimaging workflows and parallel processing using Matlab and XML</a>
<a href = "http://dx.doi.org/10.3389/fninf.2014.00090">Frontiers in Neuroinformatics 8:90</a>
Please visit <a href = "http://automaticanalysis.org">The aa website</a> for more information!
Here you can find example <a href = "matlab: cd /home/jc01/matlab/aa5/aa_parametersets">parameter sets</a> and <a href = "matlab: cd /home/jc01/matlab/aa5/examples">examples</a>.
Ready.
Cannot find parameters file aap_parameters_user.xml, opening user interface to generate a new file
Undefined function or variable 'yID'.
Error in xml_read>mergeStructs (line 469)
itemmatch = strcmp(xIDs,yID);
Error in xml_read>mergeStructs (line 482)
res.(names{fnum}) = mergeStructs(x.(names{fnum}),y.(names{fnum}),Pref);
Error in xml_read>mergeStructs (line 482)
res.(names{fnum}) = mergeStructs(x.(names{fnum}),y.(names{fnum}),Pref);
Error in xml_read>expand_tree (line 446)
otree = mergeStructs(otree,itree.local,Pref);
Error in xml_read (line 195)
tree = expand_tree(tree,DPref);
Error in aarecipe (line 56)
xml=xml_read(seedparam,Pref);
Error in aa_user_ASL (line 17)
aap=aarecipe('aap_tasklist_ASL.xml');
469 itemmatch = strcmp(xIDs,yID);
xIDs
xIDs =
1x2 cell array
{'spm'} {'eeglab'}It looks like this is also caused by a problem with how the toolboxes are coded as struct arrays in the defaults now. Would you mind checking if CBSU_defaults is compliant with how things are meant to work now? I copied from aap_parameters_defaults.xml so if CBSU is wrong it's possible this file is wrong too. Hope you can reproduce this issue. |
|
@jooh, the issue was not the parameterset but that I have not updated |
|
Ok, good, so now I'm back to the exception I reported above in validatepaths. |
|
@jooh, Your initial guess about indexing was a good lead, but we should not index with |
|
That did it. I already completed the general tests. Running the cbu tests now... |
|
Now crashing on aamod_meg_denoise_ICA_1:
In fact it looks like the problem is that |
|
That is a known bug I am afraid. We can discuss how we want to proceed. I remember Rik was reluctant to give out his scrip, and in this case, I prefer removing it completely. |
|
Hm, well the tests must have passed in previous version by falling back to runica then, because I don't think rik_runica has ever been on my path. So I think it's fine to just ensure EEGLAB is available in this module. Unless @RikHenson would like to contribute this function to AA? It's a little weird that a public AA module references a personal function. |
|
@jooh, I have updated the path to EEGLAB at the CBSU and its usage in the ICA module. |
|
I think we're close now. I managed to get through the CBU test suite once, but after so many updates I thought it would be safest to do a clean re-run. Now I get stuck on aamod_coreg_extended_2 in the aa_user_MTI pipeline: aas_checkreg_avi, line 101. The images that are being saved are The Matlab version is R2019a. I see the following warning from spm_check_registration before the exception: |
|
I am not sure what the issue might be but I have an educated guess. |
|
Ok, just had an intriguing exception where aas_shell appears to have started to treat my shell as CSH rather than bash half way through the tests, with all kind of errors as a result (can't use |
|
I'm going to be away for a bit so going merge today so we can finish this very extended review. I'm satisfied that all the user scripts run in isolation, which is going to have to be good enough. There are definitely weird dependencies between the different user scripts when you run them in the same Matlab session during The underlying cause of all this is that AA has a lot of hidden state, both in terms of the cache and the SPM GUI. For now it remains good advice to start a new Matlab session whenever you try to run a new user script, but this is going to cause confusion for new users because it runs a little counter to how people typically run Matlab (as a continuous session, not a one-off 'application'). Longer term it would be good to ensure that AA starts and closes more cleanly. |
|
Thank you, @jooh, for the exhaustive and persistent testing. 🥇 |
FIX - CI: reduce MEEGstat sample
aacache
aacach is a versatile store for various variables. It is originally supposed to be read and written via the supplied functions (
aas_cache_putandaas_cache_get); however, some functions have accessed it directly, which is not a good practice. This PR correct these functions.Toolboxes
Toolboxes provides interfaces for supported MATLAB toolboxes. These interfaces (in extrafunctions/toolboxes) simplifies and unifies managing and using these toolboxes within the code; e.g. it ensures that the given toolbox is fully removed from the path when unloaded while keeping the required folders in the memory. It is especially udefull when one needs to switch between them frequently (e.g. EEGLAB and FieldTrip for analysing MEEG data).
Toolboxes can be defined flexibly as a list in the parameterset:
automaticanalysis/aa_parametersets/aap_parameters_defaults.xml
Lines 36 to 49 in 93a89f7
Debugs
SPM has implemented several of our modifications since SPM12 r7487. This PR removes the redundancy from our codebase.
CAVE: From now on, SPM12 r7487 or later is required for aa.