Discussion:
Extract submatrix from ROI
Vincent Le Saux
2012-09-13 15:10:51 UTC
Permalink
Hi all,

I'm using guiqwt and guidata to build a simple software dedicated to the
processing of infrared images (succession of images) and it is pretty easy
with guidata and guiqwt (thanks Pierre!). One of my main concern is to
analyze specific areas of various form and to perform mean operation over
these zones in order to get a scalar. So, I need:
- to draw the specific forms I need on the image -> No problem thanks
to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific forms,
i.e. the list of pixels that are contained in the form -> I didn't find
such tools in the source code (the cross_section tools can be easily
adapted for the rectangle shape, but for the other forms, I'm stucked!).

So my question is: is it possible to extract easily and automatically the
submatrix from a ROI defined by the various tool shape (may be with a
mask??)? The idea would be to get directly this information while creating
the object (and to update automatically the informations when we change the
form).

Any ideas?

Thank you.

Cheers,

Vincent
Vincent Le Saux
2012-09-18 08:45:21 UTC
Permalink
Hi all,

For those who are interested in, I found a solution (that works, but needs
one additional specific module included in python(x,y)). I get the
informations from the form (using for example the get_points() method) and
then use the skimage.draw module that do exactly what I want.

Pierre, is it planned to add such a tool in guiqwt (or guiplot later)? To
my opinion, it is very useful feature...

Cheers,

Vincent
Post by Vincent Le Saux
Hi all,
I'm using guiqwt and guidata to build a simple software dedicated to the
processing of infrared images (succession of images) and it is pretty easy
with guidata and guiqwt (thanks Pierre!). One of my main concern is to
analyze specific areas of various form and to perform mean operation over
- to draw the specific forms I need on the image -> No problem thanks
to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific forms,
i.e. the list of pixels that are contained in the form -> I didn't find
such tools in the source code (the cross_section tools can be easily
adapted for the rectangle shape, but for the other forms, I'm stucked!).
So my question is: is it possible to extract easily and automatically the
submatrix from a ROI defined by the various tool shape (may be with a
mask??)? The idea would be to get directly this information while creating
the object (and to update automatically the informations when we change the
form).
Any ideas?
Thank you.
Cheers,
Vincent
Stefan Reinsberg
2012-09-18 08:48:47 UTC
Permalink
This sounds very interesting. Can you provide some further details? Or
maybe some code snippets?
Cheers, Stefan
Post by Vincent Le Saux
Hi all,
For those who are interested in, I found a solution (that works, but needs
one additional specific module included in python(x,y)). I get the
informations from the form (using for example the get_points() method) and
then use the skimage.draw module that do exactly what I want.
Pierre, is it planned to add such a tool in guiqwt (or guiplot later)? To
my opinion, it is very useful feature...
Cheers,
Vincent
Post by Vincent Le Saux
Hi all,
I'm using guiqwt and guidata to build a simple software dedicated to the
processing of infrared images (succession of images) and it is pretty easy
with guidata and guiqwt (thanks Pierre!). One of my main concern is to
analyze specific areas of various form and to perform mean operation over
- to draw the specific forms I need on the image -> No problem thanks
to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific forms,
i.e. the list of pixels that are contained in the form -> I didn't find
such tools in the source code (the cross_section tools can be easily
adapted for the rectangle shape, but for the other forms, I'm stucked!).
So my question is: is it possible to extract easily and automatically the
submatrix from a ROI defined by the various tool shape (may be with a
mask??)? The idea would be to get directly this information while creating
the object (and to update automatically the informations when we change the
form).
Any ideas?
Thank you.
Cheers,
Vincent
Vincent Le Saux
2012-09-20 15:33:11 UTC
Permalink
In haste,


imagewidget = ImageWidget(xlabel="x [pixels]",ylabel="y [pixels]")
...
item = make.image(...)
# to get the item list (panel)
listitems = imagewidget.panels['itemlist']
# to get an item (here, the first one, supposing a form has already been
created and is placed on the top of the list)
form = listitems.listwidget.items[0]
# to get the characteristic points
points = form.get_points()
... # then it is very easy to use the skimage.draw module (see for example
:
http://scikits-image.org/docs/dev/auto_examples/plot_shapes.html#example-plot-shapes-py)

If you have any further questions (or if you want a complete example), feel
free to ask!

Cheers,

Vincent
Post by Stefan Reinsberg
This sounds very interesting. Can you provide some further details? Or
maybe some code snippets?
Cheers, Stefan
Post by Vincent Le Saux
Hi all,
For those who are interested in, I found a solution (that works, but
needs one additional specific module included in python(x,y)). I get the
informations from the form (using for example the get_points() method) and
then use the skimage.draw module that do exactly what I want.
Pierre, is it planned to add such a tool in guiqwt (or guiplot later)? To
my opinion, it is very useful feature...
Cheers,
Vincent
Post by Vincent Le Saux
Hi all,
I'm using guiqwt and guidata to build a simple software dedicated to the
processing of infrared images (succession of images) and it is pretty easy
with guidata and guiqwt (thanks Pierre!). One of my main concern is to
analyze specific areas of various form and to perform mean operation over
- to draw the specific forms I need on the image -> No problem
thanks to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific forms,
i.e. the list of pixels that are contained in the form -> I didn't find
such tools in the source code (the cross_section tools can be easily
adapted for the rectangle shape, but for the other forms, I'm stucked!).
So my question is: is it possible to extract easily and automatically
the submatrix from a ROI defined by the various tool shape (may be with a
mask??)? The idea would be to get directly this information while creating
the object (and to update automatically the informations when we change the
form).
Any ideas?
Thank you.
Cheers,
Vincent
Stefan Reinsberg
2012-09-20 15:42:07 UTC
Permalink
Thanks Vincent, Let me try this out and if I do stumble I'll come back
with more questions. Cheers, Stefan
Samuel Garcia
2012-09-21 06:57:23 UTC
Permalink
Received: by 10.216.227.196 with SMTP id d46mr186301weq.0.1348210661158;
Thu, 20 Sep 2012 23:57:41 -0700 (PDT)
X-BeenThere: guidata_guiqwt-/***@public.gmane.org
Received: by 10.216.206.216 with SMTP id l66ls4238661weo.4.gmail; Thu, 20 Sep
2012 23:57:40 -0700 (PDT)
Received: by 10.216.234.135 with SMTP id s7mr242059weq.8.1348210660738;
Thu, 20 Sep 2012 23:57:40 -0700 (PDT)
Received: by 10.216.234.135 with SMTP id s7mr242058weq.8.1348210660724;
Thu, 20 Sep 2012 23:57:40 -0700 (PDT)
Received: from cisrsmtp4.univ-lyon1.fr (cisrsmtp4.univ-lyon1.fr. [2001:660:5001:a188::147])
by gmr-mx.google.com with ESMTP id k11si166491wiv.0.2012.09.20.23.57.40;
Thu, 20 Sep 2012 23:57:40 -0700 (PDT)
Received-SPF: pass (google.com: domain of sgarcia-***@public.gmane.org designates 2001:660:5001:a188::147 as permitted sender) client-ip=2001:660:5001:a188::147;
Received: from localhost (localhost [127.0.0.1])
by cisrsmtp4.univ-lyon1.fr (Postfix) with ESMTP id 808BEE005A
for <guidata_guiqwt-/***@public.gmane.org>; Fri, 21 Sep 2012 08:57:40 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at cisrsmtp4.univ-lyon1.fr
Received: from cisrsmtp4.univ-lyon1.fr ([127.0.0.1])
by localhost (cisrsmtp4.univ-lyon1.fr [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id P6g6bjStu7jX for <guidata_guiqwt-/***@public.gmane.org>;
Fri, 21 Sep 2012 08:57:40 +0200 (CEST)
Received: from olfac.univ-lyon1.fr (olfac.univ-lyon1.fr [194.167.217.51])
by cisrsmtp4.univ-lyon1.fr (Postfix) with ESMTP id 20259E0019
for <guidata_guiqwt-/***@public.gmane.org>; Fri, 21 Sep 2012 08:57:40 +0200 (CEST)
Received: from [IPv6:::1] (neuro000.univ-lyon1.fr [194.167.217.2])
by olfac.univ-lyon1.fr (Postfix) with ESMTP id 30429311511
for <guidata_guiqwt-/***@public.gmane.org>; Fri, 21 Sep 2012 08:57:37 +0200 (CEST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0
In-Reply-To: <ed0b54ba-f28c-42b5-92d4-39a45c6d948f-/***@public.gmane.org>
X-Enigmail-Version: 1.4.4
X-Original-Sender: sgarcia-***@public.gmane.org
X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com:
domain of sgarcia-***@public.gmane.org designates 2001:660:5001:a188::147 as
permitted sender) smtp.mail=sgarcia-***@public.gmane.org
Precedence: list
Mailing-list: list guidata_guiqwt-/***@public.gmane.org; contact guidata_guiqwt+owners-/***@public.gmane.org
List-ID: <guidata_guiqwt.googlegroups.com>
X-Google-Group-Id: 808950355297
List-Post: <http://groups.google.com/group/guidata_guiqwt/post?hl=en_FR>, <mailto:guidata_guiqwt-/***@public.gmane.org>
List-Help: <http://groups.google.com/support/?hl=en_FR>, <mailto:guidata_guiqwt+help-/***@public.gmane.org>
List-Archive: <http://groups.google.com/group/guidata_guiqwt?hl=en_FR>
Sender: guidata_guiqwt-/***@public.gmane.org
List-Subscribe: <http://groups.google.com/group/guidata_guiqwt/subscribe?hl=en_FR>,
<mailto:guidata_guiqwt+subscribe-/***@public.gmane.org>
List-Unsubscribe: <http://groups.google.com/group/guidata_guiqwt/subscribe?hl=en_FR>,
<mailto:googlegroups-manage+808950355297+unsubscribe-/***@public.gmane.org>
Archived-At: <http://permalink.gmane.org/gmane.comp.python.scientific.guidata-guiqwt/181>

Hi,
I did something similar sometimes ago with that function:

from matplotlib.nxutils import points_inside_poly

You give a list of pixel and get a list a bool, and you can create a
image mask of bool.

I do not known if there is something similar in guiqwt.
Certainly yes.

Samuel
Post by Vincent Le Saux
Hi all,
I'm using guiqwt and guidata to build a simple software dedicated to
the processing of infrared images (succession of images) and it is
pretty easy with guidata and guiqwt (thanks Pierre!). One of my main
concern is to analyze specific areas of various form and to perform
- to draw the specific forms I need on the image -> No problem
thanks to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific
forms, i.e. the list of pixels that are contained in the form -> I
didn't find such tools in the source code (the cross_section tools can
be easily adapted for the rectangle shape, but for the other forms,
I'm stucked!).
So my question is: is it possible to extract easily and automatically
the submatrix from a ROI defined by the various tool shape (may be
with a mask??)? The idea would be to get directly this information
while creating the object (and to update automatically the
informations when we change the form).
Any ideas?
Thank you.
Cheers,
Vincent
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Samuel Garcia
Lyon Neuroscience
CNRS - UMR5292 - INSERM U1028 - Universite Claude Bernard LYON 1
Equipe R et D
50, avenue Tony Garnier
69366 LYON Cedex 07
FRANCE
Tél : 04 37 28 74 24
Fax : 04 37 28 76 01
http://olfac.univ-lyon1.fr/unite/equipe-07/
http://neuralensemble.org/trac/OpenElectrophy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pierre Raybaut
2012-09-22 18:35:44 UTC
Permalink
Thank you all for these interesting comments.
I may add such features to guiqwt in the near future.

For now the only supported similar features are:
* extract array from a rectangle shape:
http://code.google.com/p/guiqwt/source/browse/guiqwt/image.py#1484
* mask rectangular/circular areas on an array:
http://code.google.com/p/guiqwt/source/browse/guiqwt/tests/image_masked.py

Cheers,
-Pierre
Post by Samuel Garcia
Hi,
from matplotlib.nxutils import points_inside_poly
You give a list of pixel and get a list a bool, and you can create a
image mask of bool.
I do not known if there is something similar in guiqwt.
Certainly yes.
Samuel
Post by Vincent Le Saux
Hi all,
I'm using guiqwt and guidata to build a simple software dedicated to
the processing of infrared images (succession of images) and it is
pretty easy with guidata and guiqwt (thanks Pierre!). One of my main
concern is to analyze specific areas of various form and to perform
- to draw the specific forms I need on the image -> No problem
thanks to the polygone, rectangle, circle and freeform tools ;
- to extract the submatrices contained within these specific
forms, i.e. the list of pixels that are contained in the form -> I
didn't find such tools in the source code (the cross_section tools can
be easily adapted for the rectangle shape, but for the other forms,
I'm stucked!).
So my question is: is it possible to extract easily and automatically
the submatrix from a ROI defined by the various tool shape (may be
with a mask??)? The idea would be to get directly this information
while creating the object (and to update automatically the
informations when we change the form).
Any ideas?
Thank you.
Cheers,
Vincent
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Samuel Garcia
Lyon Neuroscience
CNRS - UMR5292 - INSERM U1028 - Universite Claude Bernard LYON 1
Equipe R et D
50, avenue Tony Garnier
69366 LYON Cedex 07
FRANCE
Tél : 04 37 28 74 24
Fax : 04 37 28 76 01
http://olfac.univ-lyon1.fr/unite/equipe-07/
http://neuralensemble.org/trac/OpenElectrophy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Loading...