rhodricusack / diffeomorph

6 stars 12 forks source link

Help with running the code #3

Closed averagestudentdontfail closed 2 years ago

averagestudentdontfail commented 2 years ago

Hi,

I am a undergraduate student at Western Sydney University wanting to create controlled scrambled stimulus images for a python coded psychology experiment using your code to create diffeomorphic transformations in MatLabs. My stimulus images are Mooney faces that I have created using a parametric machine model algorithm with JavaScript in VCS from another author. The problem however is that i am very inexperienced at using MatLabs and cannot figure out how to use your code. I have read the associated paper you provided in the GitHub description to try better understanding how the code works however that did not translate into anything helpful when it came down to me actually trying to run the code. Do you have any detailed instructions or tips that could help me use your code?

Kind regards, Kiran.

rhodricusack commented 2 years ago

Thanks for your interest in the code. How far have you got? Do you Matlab running so you get the >> prompt?


From: averagestudentdontfail @.> Sent: Thursday 31 March 2022 22:40 To: rhodricusack/diffeomorph @.> Cc: Subscribed @.***> Subject: [rhodricusack/diffeomorph] Help with running the code (Issue #3)

Hi,

I am a undergraduate student at Western Sydney University wanting to create controlled scrambled stimulus images for a python coded psychology experiment using your code to create diffeomorphic transformations in MatLabs. My stimulus images are Mooney faces that I have created using a parametric machine model algorithm with JavaScript in VCS from another author. The problem however is that i am very inexperienced at using MatLabs and cannot figure out how to use your code. I have read the associated paper you provided in the GitHub description to try better understanding how the code works however that did not translate into anything helpful when it came down to me actually trying to run the code. Do you have any detailed instructions or tips that could help me use your code?

Kind regards, Kiran.

— Reply to this email directly, view it on GitHubhttps://github.com/rhodricusack/diffeomorph/issues/3, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAL7HSMMMIOR46LI6GV4YD3VCYLUNANCNFSM5SGYVD3A. You are receiving this because you are subscribed to this thread.Message ID: @.***>

averagestudentdontfail commented 2 years ago

Yes when i open it in MatLabs i get a "Command window" at the bottom with >> prompt. Not sure where to go from there however.

rhodricusack commented 2 years ago

And can you open the diffeomorph.m file in the editor? You can then either type diffeomorph at the >> prompt or press the green "play" button in the editor.

You'll need to the fix the input filename(s)

Rhodri Cusack Director, Trinity College Institute of Neuroscience The Thomas Mitchell Professor of Cognitive Neuroscience School of Psychology Trinity College Dublin Dublin 2 Ireland

Learn about TCIN websitehttp://www.tcd.ie/neuroscience videohttps://www.tcd.ie/Neuroscience/assets/images/TCIN-Long-Film.mp4 (shorthttps://www.tcd.ie/Neuroscience/assets/images/TCIN-Short-Film.mp4) MRIhttp://www.tcd.ie/neuroscience/mri Overview of my group: www.cusacklab.orghttp://www.cusacklab.org/ Infant fMRI: www.foundcog.orghttp://www.foundcog.org/ Online tasks for infants: baby.cusacklab.orghttp://baby.cusacklab.org/


From: averagestudentdontfail @.> Sent: Friday, April 1, 2022 9:21:51 AM To: rhodricusack/diffeomorph @.> Cc: Rhodri Cusack @.>; Comment @.> Subject: Re: [rhodricusack/diffeomorph] Help with running the code (Issue #3)

Yes when i open it in MatLabs i get a "Command window" at the bottom with >> prompt. Not sure where to go from there however.

— Reply to this email directly, view it on GitHubhttps://github.com/rhodricusack/diffeomorph/issues/3#issuecomment-1085589561, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAL7HSOKNDLNEHE6GZHVJ4LVC2WZ7ANCNFSM5SGYVD3A. You are receiving this because you commented.Message ID: @.***>

rhodricusack commented 2 years ago

Hi Seems like possibly a problem loading the images. Before running, can you type "dbstop if error" (or if you're running from the editor, click on line 63 so that a red stop symbol appears). Run the code When it stops, at command line type

size(Im) Best R


From: averagestudentdontfail @.> Sent: Saturday 2 April 2022 06:21 To: rhodricusack/diffeomorph @.> Cc: Rhodri Cusack @.>; Comment @.> Subject: Re: [rhodricusack/diffeomorph] Help with running the code (Issue #3)

I have tried to set values of paths like this:

picpath='C:\Users\send2\OneDrive\Documents\GitHub\diffeomorph\input' outpicpath='C:\Users\send2\OneDrive\Documents\GitHub\diffeomorph\output'

and have fixed image type for my stimulus images like this:

imgtype='png'; %file type fns=dir(fullfile(picpath,sprintf('*.png',imgtype))); figure(10);

I have left all variables at the start of the function as the default values (e.g., maxdistortion=160; % changes max amount of distortion nsteps=40; % number of steps, imsz= 1000)

Howvever, when i try running the function diffeomorphic i get the error as follows:

Index in position 1 is invalid. Array indices must be positive integers or logical values.

Error in diffeomorphic (line 63) Im((x1+1):(x1+Psz(1)),(y1+1):(y1+Psz(2)),:)=P;

— Reply to this email directly, view it on GitHubhttps://github.com/rhodricusack/diffeomorph/issues/3#issuecomment-1086550394, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAL7HSOP5BOS7QXABUKYM4DVC7KNHANCNFSM5SGYVD3A. You are receiving this because you commented.Message ID: @.***>

averagestudentdontfail commented 2 years ago

Hi,

I believe i have gotten your code working for create diffeomorphic transformations for my images. I fixed the path values by making sure not to have any of the folders in the root folder that contains the diffeomorphic.m file.

I fixed the values for the paths by making it access my local system instead of my onedrive:

picpath='C:\Users\send2\OneDrive\University\Psychology\YEAR TWO\AUTUMN\Perception\Assessments\Scientific Report\Part 1\Stimulus\Processed\Cropped_upright'; outpicpath='C:\Users\send2\OneDrive\University\Psychology\YEAR TWO\AUTUMN\Perception\Assessments\Scientific Report\Part 1\Stimulus\Processed\Distorted';

I also fixed the image file type for my stimulus images for png:

imgtype='png'; %file type fns=dir(fullfile(picpath,sprintf('*.png',imgtype))); figure(10);

I have now gotten outputs from both Figure 10 and Figure 11 in seperate screens and i am very happy with how the diffeomorphic transformations turned out in the output folder. Thank you so much for helping me with running your code, it was perhaps my second time actually using MatLabs and i learned a lot from this experience of using someone else's code. Just one question if you do not mind, what do the outputs in Figure 10 signify?