neuroelf / neuroelf-matlab

NeuroElf (MATLAB)
Other
15 stars 14 forks source link

VTC_Filter function #7

Closed frankgarcea closed 2 years ago

frankgarcea commented 2 years ago

Hi all - I do not have an explicit error but couldn't find documentation on the neuroelf website regarding the VTC filter function. I figured I'd reach out to folks here.

I am using fmriprep to pre-process my data. I then use the neuroelf toolbox in matlab to convert the nifti file to VTC that is described here. This works without issue.

I want to perform a temporal high pass filter of my VTC file using the VTC_Filter function. My goal is to use the GLM with Fourier basis set option (2 sines/cosine) but it's unclear to me how to implement this using neuroelf. For instance, I see in the VTC_Filter documentation there are the following input parameters.

.temp enable temporal filtering (default: false) .temphp temporal highpass (inv. smoothing) in units (def: 0)

so I could set the following parameters but it's unclear to me what the unit of temphp should be.

% set params and run VTC filter opts.temp = 1; opts.temphp = 2; filteredVTC = VTC.Filter(opts);

Is 'opts.temphp = 2' equivalent to 2 sines/cosine?

Should the filteredVTC be identical to a VTC manually run through the the high pass temporal filtering function internal to BrainVoyager? I've been inspecting correlations between random voxels in the BV-outputted THPF (2 sines/cosine) VTC and filteredVTC from neuroelf and the correlation values range from .4 to .6 to 1.

I would expect the two VTCs to be highly similar but they're not, so I suspect I'm doing something wrong. Any help/input on this issue would be much appreciated.

Thanks all. FG

frankgarcea commented 2 years ago

@alexsayal -- I wanted to loop you in in case you have any insight on this issue. I used your code to convert fmriprep outputs to VTC (super helpful btw, thanks). Do you use neuroelf functions for high pass filtering within matlab?

neuroelf commented 2 years ago

Hey Frank,

I'm so sorry... For some reason it never occurred to me to look at the "Issues" tab -- maybe because I assumed that GitHub would send email notifications to the repo owner(s) if an issue is being posted...

Anyway, the way I implemented looking up information about functions is through a general "help" method on objects. This works for every xff (file format) object, such as VTCs, as follows:

% create VTC object vtc = xff('new:vtc');

% get help on what methods are available vtc.help;

% get help on a specific method vtc.help('Filter')

There are definitely some methods/functions for which this may still not be detailed enough (to, for instance, understand what is going on under the hood).

It is then relatively easy to open the source code of a method

% open editor with object method edit @xff/private/vtc_Filter

% or for a method shared across object types edit @xff/private/aft_MaskWithVMR

Please note, for bringing up help items, case is ignored. But since MATLAB itself is, in fact, case sensitive, the "edit ..." line will only work if the case is given as in the function filename...

Hope this helps :)