Discussion:
How to make widget to display data as rgb image, with coordinate selection
vprice1030
2012-07-26 19:22:46 UTC
Permalink
Hi all, I'm trying to display a 2D numpy array as an RGB image, with
contrast selection. I need to then set a scale to the image and use mouse
selection to determine the coordinates of targets within the image. I was
trying to use pyqtgraph to do this but it doesn't appear that I can plot an
image as data rather than just an image, so I need to start over using
guiqwt. I've attached my script... the frame data is read in as the slider
moves. If someone could look it over for me and point me in the correct
direction for embedding an image display widget like this, I'd be really
grateful... sorry if the code is sloppy, I'm an uber beginner both with
Python and PyQt.
Carlos Pascual
2012-07-30 08:38:05 UTC
Permalink
Hi,

It would help if you provide a simpler script (I tried to launch your script,
and after installing pyqtgraph I bumped against "import fileheader"... so I
gave up).
Post by vprice1030
Hi all, I'm trying to display a 2D numpy array as an RGB image, with
contrast selection. I need to then set a scale to the image and use mouse
selection to determine the coordinates of targets within the image. I was
trying to use pyqtgraph to do this but it doesn't appear that I can plot an
image as data rather than just an image, so I need to start over using
guiqwt. I've attached my script... the frame data is read in as the slider
moves. If someone could look it over for me and point me in the correct
direction for embedding an image display widget like this, I'd be really
grateful... sorry if the code is sloppy, I'm an uber beginner both with
Python and PyQt.
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
vprice1030
2012-07-30 11:01:28 UTC
Permalink
Sorry about that-- bear with me, I'm very new to all of this and was
introduced to programming and python a couple of months ago. Perhaps I
don't really even need code...using guiqwt I tried using a makeXYImage
method but it doesn't seem to want to read in my filename (I'm getting the
coerce unicode error). The "fileheader" is simply the module that reads in
the file and parses out the data into headers and data arrays every 256
bytes. I've uploaded that as well. The unicode error is strange, as I've
gotten it to read in files successfully using pyqtgraph with subsequent
changes to code.

Will the makeXYImage method allow for ROI selection (providing I can
overcome the import error)?

Thank you!
Carlos Pascual
2012-07-31 07:25:32 UTC
Permalink
Post by vprice1030
Sorry about that-- bear with me, I'm very new to all of this and was
introduced to programming and python a couple of months ago. Perhaps I
don't really even need code...using guiqwt I tried using a makeXYImage
method but it doesn't seem to want to read in my filename (I'm getting the
coerce unicode error). The "fileheader" is simply the module that reads in
the file and parses out the data into headers and data arrays every 256
bytes. I've uploaded that as well.
What I suggested before was that you tried to provide a simpler (more to-the-
point) example. Note that we do not have access to your image files so
reproducing your issues is hard.
Post by vprice1030
The unicode error is strange, as I've
gotten it to read in files successfully using pyqtgraph with subsequent
changes to code.
Please try to make a simple script of _a few_ lines, minimizing the number of
3rd party imports (maybe just using a random-generated numpy array as the
image) and which isolates the problem/question you are having with guiqwt.
Post by vprice1030
Will the makeXYImage method allow for ROI selection (providing I can
overcome the import error)?
Not sure of what you mean...
The ImageDialog widget supports tools for overlying "shapes" (rectangles,
ellipses,...) and moving them over your image. You can use them to allow the
user to visually mark an area of your image. Then you can use the coordinates
of those shapes to select regions/slices of your data.


I hope this helps
--
+----------------------------------------------------+
Carlos Pascual Izarra
Scientific Software Coordinator
Computing Division
Cells / Alba Synchrotron [http:/www.cells.es]
Carretera BP 1413 de Cerdanyola-Sant Cugat, Km. 3.3
E-08290 Cerdanyola del Valles (Barcelona), Spain
E-mail: cpascual-***@public.gmane.org
Phone: +34 93 592 4428
+----------------------------------------------------+
Loading...