I want to offer one clarification: ImageView is a subclass of QWidget, not
QGraphicsView (but there's a good chance this error would go unnoticed).
If you want to embed the entire ImageView widget, then you would create an
empty widget in Designer and promote it to pyqtgraph.ImageView.
If you just want a view box with an image inside (no histogram, color
gradient, etc.) then add a QGraphicsView in Designer and promote it to a
pyqtgraph.GraphicsLayoutWidget. Then in your initialization code, do
something like:
viewbox = graphicslayoutwidget.addViewBox()
imageitem = pg.ImageItem()
viewbox.addItem(imageitem)
Luke
On Tue, Aug 15, 2017 at 3:20 PM, Arun Shriram <[email protected]>
wrote:
> HEY! I GOT IT! Thank you so much!
> This may seem like I'm really needy, but I have one more thing - do you
> know how I might have just the image and remove the default ROI and
> Histogram capabilities? I'm trying to follow the design of the pyqtgraph
> example file "imageAnalysis.py" that I've attached because I like the
> format of that better. Could you help me out one more time?
>
> On Tuesday, August 15, 2017 at 3:01:03 PM UTC-7, Christopher Mullins wrote:
>>
>> No, sorry that's just my badly named object. I'll explain a little more.
>>
>> QGraphicsView is a Qt class. I created the .ui file within qtdesigner,
>> which should ship with your qt distribution. Try opening up that file with
>> qtdesigner and you should get a better idea -- and there are multiple good
>> youtube tutorials on that particular tool. Look for "Graphics View" under
>> the display items on the left, that's all that is.
>>
>> After that's been dragged into my main window, I right-clicked and
>> promoted that widget to an ImageView, as per these instructions on
>> embedding pyqtgraph widgets in PyQt [2].
>>
>> From there, you can see I used the "uic" tool from within the run.py
>> script to access the UI elements. (Another option is to use uic on the
>> command line to generate a python file from the UI file and use that.)
>>
>> [2] http://www.pyqtgraph.org/documentation/how_to_use.html#embed
>> ding-widgets-inside-pyqt-applications
>>
>> On Tue, Aug 15, 2017 at 5:17 PM, Arun Shriram <[email protected]>
>> wrote:
>>
>>> Hey Christopher,
>>> This is great! Yes, embedding in PyQt was exactly what I wanted. Thank
>>> you for helping out! However, I'm not quite exactly how to go about this.
>>> Sorry, I'm kind of a newbie with PyQt and pyqtgraph, so I have a few
>>> questions. Should I redefine QGraphicsView as a class? Is that what you're
>>> doing in line 43 of the UI code you attached?
>>> Thanks again,
>>> Arun
>>>
>>> On Tuesday, August 15, 2017 at 2:09:34 PM UTC-7, Christopher Mullins
>>> wrote:
>>>>
>>>> Sounds like what you want is to embed this window into PyQt. All you
>>>> need to do is define a QGraphicsView in your main window somewhere, and
>>>> promote it to an ImageView (header file should just read: pyqtgraph).
>>>>
>>>> Then simply call the setImage function on it. Here's a modified gist
>>>> with a simple example that might do what you want [1].
>>>>
>>>> [1] https://gist.github.com/chrismullins/e5ce27ace4f3aa11fb56461
>>>> 1e37698bd
>>>>
>>>>
>>>> On Tue, Aug 15, 2017 at 4:26 PM, Arun Shriram <[email protected]>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I'm trying to do some image analysis with a .tif file (that I've
>>>>> converted into a numpy.ndarray), and I'm trying to incorporate pyqtgraph
>>>>> with my current PyQt GUI. It seems that the best way to get the image
>>>>> analysis controls I need (ROI and histogramLUT) is to call
>>>>> pyqtgraph.image() on my data, as such:
>>>>>
>>>>> import pyqtgraph as pg
>>>>>
>>>>> data = tif_file.array() # assume this gives me numpy.ndarray
>>>>>
>>>>> pg.image(data)
>>>>>
>>>>> This automatically creates an ImageWindow with all the stuff I want.
>>>>> Great! However, I'm wondering how I can make all the items in this
>>>>> ImageWindow fit in my preexisting GUI. I would like the users to have the
>>>>> image and controls display in the same window they're operating on, rather
>>>>> than display in a new window. Is this possible at all? I would really
>>>>> appreciate it if someone could help me out. Please let me know if you need
>>>>> me to explain anything more clearly.
>>>>>
>>>>> Thanks,
>>>>> Arun Shriram
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "pyqtgraph" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/pyqtgraph/0ef2e976-939f-42
>>>>> 24-9693-e69955c7c779%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/pyqtgraph/0ef2e976-939f-4224-9693-e69955c7c779%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pyqtgraph" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/pyqtgraph/867d6aeb-3002-491c-89c4-2253b96ee719%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pyqtgraph/867d6aeb-3002-491c-89c4-2253b96ee719%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pyqtgraph/7d1311fa-a34d-4199-8dc6-2ac91bd7cad6%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/7d1311fa-a34d-4199-8dc6-2ac91bd7cad6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/CACZXET_5P_jB5bKd7HG4mRxtJN7CV%3DoXFAXFncyKAzoJ5qubFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.