Using a Mask file in the command line version of PIVlab

223 views
Skip to first unread message

Susan Lehman

unread,
Mar 24, 2022, 10:50:33 AM3/24/22
to PIVlab
Hi, I have multiple movies that need to use the same mask during PIV analysis. I've created a mask file using the PIVlab GUI and saved it, but I don't see how to use that file in the command line version of PIVlab.
I see the instructions in the comment in the command line that say "If needed, generate via: imagesc(image); [temp,Mask{1,1},Mask{1,2}]=roipoly;" but I don't quite understand this.
What should I be setting s{4,2} to be equal to? My list of points that will be connected with roipoly? Or something else? 

I've tried to investigate the GUI code, but I don't really understand how to debug and track things in the GUI code, so I can't find what is going on with the mask there.  I see the sections with maskiererx and maskierery but other than copying those bits of code into the command line version, I'm not sure how to proceed.

Thanks much!

William Thielicke

unread,
Mar 26, 2022, 3:37:44 PM3/26/22
to PIVlab
You would generate your mask using:
imagesc(imread('my_image_file_that_I_want_to_draw_a_mask_for.jpg'); [temp,Mask{1,1},Mask{1,2}]=roipoly;
eventually save the mask to a mat file:
save('my_mask.mat','Mask');

Then apply this mask using:
load my_mask.mat
s{4,1}= 'Mask';                     s{4,2}=Mask; 

This should work...

Susan Lehman

unread,
Mar 29, 2022, 11:23:42 AM3/29/22
to PIVlab
Thank you so much -- that does work perfectly.  I was having a hard time understanding what format to pass the mask in, but it makes sense now.
Reply all
Reply to author
Forward
0 new messages