Selecting a ROI manually in Matlab - matlab

I'm trying to select a user-defined area and fill with 1s, preferably with mouse input. Any suggestion how? Thanks.

The command
roipoly
does exactly what you're looking for.

You'll need the Image Processing Toolbox to use roipoly as Georg suggested.
If you don't have that, you could try creating a rubber band box using
rbbox
There's a good example in the help. You might need to fiddle with units depending on how you're displaying your data. Remember to click and hold, drag and release..

h=impoly;
This code helps you to select a closed polygon of the image.

Related

ParaView: display director

I'm trying to display liquid crystal directors using ParaView. The director is a spin-2 field that should look like a headless vector, centred in the middle, like the cylinders in this picture:
https://pbs.twimg.com/media/C8fj1bWXoAEFy5R.png
I know how to make an arrow filter, like this other picture, but it's not what I want:
https://summerofhpc.prace-ri.eu/wp-content/uploads/2013/07/arrows.png
I can't find the filter that will do what I need. Could you please tell me if I need to create a custom filter or if there's a quicker way to obtain this result within ParaView?
My data are expressed as 3D vectors within a VTU (unstructured grid) file.
Thanks in advance and sorry for the newbie question!

Matlab GUI, create two tabs

I want to create two tabs within one GUI. One can show the plot of sine function, the other shows cone function. I can handle these two functions. but i do not know how to create two tabs. Thanks a lot!
If by tabs you mean 'plotting area' then you likely need to create 2 axes objects and display each plot in its own axes. In GUIDE it's very easy...more info here.
Let's say you have axes1 and axes2, you can do this:
axes(axes1) % Make axes1 the current axes.
plot(sin(...))
axes(axes2) % Make axes2 the current axes
plot(...)
and that's it. Hope this is what you mean! If not sorry I misunderstood the question.
EDIT
I thought about it and I'm probably wrong about what I thought a tab is. Matlab does not allow to do it directly, although it might be possible with the GUI Layout Toolbox. Here is a submission from the FIle Exchange which could be interesting to you: link here!. Sorry abut the confusion.
uitab() can be used for creating tabs. If you want to create tabs using guide it's currently not natively supported but possible with a work around I described here.

how to stop Matlab figure from maximizing?

I want to disable the Maximize option of Matlab figure.
There's a figure property you need to change for that:
set(fHandle,'Resize','off');
The MATLAB File Exchange has WindowAPI, which does exactly what you're looking for.
You can crop the complete window border by:
WindowAPI(gcf, 'Clip', true);

Star rating in Matlab GUI

Is there a way to add a rating button to a matlab GUI?
something like that
http://www.fyneworks.com/jquery/star-rating/
AFAIK there isn't a built in UIControl that provides this functionality. The closest control that I can think of is slider. Specify the MIN, MAX, and step size and the user will be bound to forced to select one of a few specific values.
Other options integrating a JAVA component into your GUI
http://blog.noblemaster.com/2010/08/31/star-rating-panel-for-java-swing/
http://code.google.com/p/starrating/
Or you can come up with a clever way to do it in matlab using a collection of radiobuttons and images.
I ended up writing my own rating system
http://www.mathworks.com/matlabcentral/fileexchange/41997-star-rating

Cleaning up blurry images using Matlab

I want to take an image of blurry cylindrical objects and get rid of the blur, basically sharpen the image. How do I do that in Matlab?
See the "sharpening" section in http://www.aquaphoenix.com/lecture/matlab10/page3.html.
You can do it with filters.
See here, section 10.2.4 here: http://www.aquaphoenix.com/lecture/matlab10/page3.html
In addition to all the good answers by others: for the very very simple inputs, you can simply threshold the image if you just need the boundary of those cylinders.