Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PhysIO Toolbox to just denoise movement regressors #160

Open
mdryzer1 opened this issue Oct 8, 2021 · 8 comments
Open

Use PhysIO Toolbox to just denoise movement regressors #160

mdryzer1 opened this issue Oct 8, 2021 · 8 comments
Assignees
Labels
physio Issues related to PhysIO Toolbox question

Comments

@mdryzer1
Copy link

mdryzer1 commented Oct 8, 2021

[REDACTED]

@mrikasper mrikasper self-assigned this Oct 8, 2021
@mrikasper mrikasper added physio Issues related to PhysIO Toolbox question labels Oct 8, 2021
@mrikasper
Copy link
Member

Dear Michael,

indeed, you can run PhysIO for the motion models only. For your reference, I have attached a version SPM batch file of the Philips ECG3T example where the physiological logfiles and models are removed and just the realignment parameters and motion outliers included. It's an .m-file, but I had to rename it to .txt for github.

All the best,
Lars
philips_ecg3t_motion_only_spm_job.txt

@mdryzer1
Copy link
Author

mdryzer1 commented Oct 14, 2021 via email

@mrikasper mrikasper reopened this Oct 26, 2021
@mrikasper
Copy link
Member

Dear Michael,

somehow I cannot see the screenshot. Could you try to upload it to github again, please? I just reopened your issue.

In general, did you include the multiple_regressors.txt file that PhysIO creates to the GLM specification?

Secondly, would you have the PhysIO batch editor file (preferably in .m format) available, so I can see what options for the motion model you set?

Looking forward to your feedback,
Lars

@mdryzer1
Copy link
Author

Hello Lars,

I apologize for the inconvenience. I have attached both the screenshot I mentioned in the email as well as the MATLAB script I use to run the Toolbox. As I stated in the email, I expected to see the 6 motion regressors (as 6 additional columns) for each of the 7 sessions; however, the review only shows the conditions and modulators I specified in the model. I did use the multiple_regressors.txt file produced by the Toolbox script in my model specification, but that is what lead to the image you see below.

The MATLAB script contains all the code I use to navigate to the appropriate directories and push the required files/parameters through the Toolbox. The settings I specify for the Toolbox can be found in lines 35-84. Let me know if you have any additional questions, and I will do what I can to help. Again, thank you for assisting me in this.

Screenshot of 1st-level model after SPM estimation:
https://user-images.githubusercontent.com/68439785/139290401-0820fdc8-2e9a-4c7a-b3e7-6b6afdd2b232.png

ZIP file containing MATLAB script:
https://github.com/translationalneuromodeling/tapas/files/7435592/physio_motion_detector_job.zip

Best,
Michael

@mrikasper
Copy link
Member

Dear Michael,

the .m-file looks correct to me, so this behavior seems strange. May I ask

  1. Do the multiple_regressors*.txt files look reasonable for each run? (You could also load them into matlab and plot them with imagesc).
  2. The code you attached only includes the preprocessing steps. Could you send me the batch file of the first level GLM specification as well?

Thank you!

All the best,
Lars

@mdryzer1
Copy link
Author

Hi Lars,

Thank you for your response. Yes, the regressor files look as expected. I've attached two images from the imagesc output: one from a session where the subject moved very little and the other from a session where the subject moved a lot. (It goes without saying that I won't be including the session where they moved way too much.)

Also, I apologize for not including the 1st-level GLM. I interpreted your previous message incorrectly and thought you only wanted the PhysIO file. Please see the .m file for the GLM below. The lines that are of interest to you are lines 430-439 and 614-618. That is where I specify the motion regressors for each of my sessions.

Please let me know if I can help you in any other way. And thank you for your help.

Best,
Michael

Example imagesc output, little movement: (https://user-images.githubusercontent.com/68439785/139472934-a5400c39-72c2-4754-a870-b04a1c96d227.png)

Example imagesc output, much movement: (https://user-images.githubusercontent.com/68439785/139473351-050cad09-7e95-4f83-bce1-a61a34b9d2d6.png)

1st-level GLM code: (https://github.com/translationalneuromodeling/tapas/files/7443720/run_1st_level_job_v1.zip)

@mrikasper
Copy link
Member

Dear Michael,

you didn't misunderstand at all, my question about the GLM batch was a follow-up, because there was nothing conspicuous I could see in the PhysIO batch.

Looking at the run_1st_level_job.m file now, I also don't see anything that could explain the absence of the multiple regressors in the GLM specification.

But I don't have the image files, so I cannot run your script myself, and some of the logic is a bit nested to understand without having the data. Would you be able to provide the matlabbatch variable as it is returned at the end of the script, please?

Since you use spm_select to define the multiple_regressors files, this should also clarify whether they indeed exist where the script expects them

    matlabbatch{1}.spm.stats.fmri_spec.sess(f + b).multi_reg = ... 
    cellstr(spm_select('FPList', fullfile(subject_path, 'func'), ['sub-' subjects{1} '_multiple_regressors_task-FatigueChoice_run-' num2str(f) '_bold.txt'])); 

All the best,
Lars

@mdryzer1
Copy link
Author

mdryzer1 commented Nov 2, 2021

Hi Lars,

Please see the matlabbatch file you requested attached below. I looked at this file myself and found that all of the multiple regressors were blank, which would explain the absence of these regressors in the 1st-level GLM. I opened the script with the SPM batch editor and manually added the regressor files and got the GLM below (it has the right number of regressors for each session), so it would appear that there is an issue in my code concerning how the script selects the regressor files (as you suspected).

I'm looking now to see why the script isn't selecting the regressors and how to solve the issue. Thank you for all of your help thus far.

matlabbatch.zip: (https://github.com/translationalneuromodeling/tapas/files/7462067/matlabbatch.zip)

GLM with regressors: (https://user-images.githubusercontent.com/68439785/139881956-a7cacfb3-955b-4109-aa4f-029ac7b52407.png)

Sincerely,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
physio Issues related to PhysIO Toolbox question
Projects
None yet
Development

No branches or pull requests

2 participants