comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: GUI strategy advice needed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: GUI strategy advice needed [message #44148] Tue, 24 May 2005 14:29 Go to next message
Leslie Welser is currently offline  Leslie Welser
Messages: 11
Registered: March 2005
Junior Member
Mike and Ben,
Thanks so much for the help, it worked beautifully!
-Leslie
Re: GUI strategy advice needed [message #44149 is a reply to message #44148] Tue, 24 May 2005 13:24 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> You probably know this already, but IDLgrColorbar has these properties
> (in addition to a bunch of of others...) taken from an example instance.
> They are not publicly exposed in IDL, but you could take advantage of
> them the way you describe.

I shy away from using things that are not in the public API. While what
you say is true, it has a greater potential to lead to code that is hard
to understand and maintain, especially if someone else is doing the
understanding and maintaining. I'm a purist when it comes to coding
style and I'll always try to fit into the public API, no matter the
language being used. Going beyond the API is an absolute last resort.

-Mike
Re: GUI strategy advice needed [message #44150 is a reply to message #44149] Tue, 24 May 2005 13:04 Go to previous messageGo to next message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Michael Wallace wrote:
>> Wow, looks like I'm the colorbar expert all of a sudden. I typically
>> don't bother with the axis within IDLgrColorbar. Instead I have an
>> IDLgrColorbar object with no axis displayed and an independent
>> IDLgrAxis aligned along one of the sides of the colorbar. I find this
>> a lot easier to work with because I have complete control over the
>> presentation of the axis.
>>
>> Maybe one of these days, I'll finally get around to writing my own
>> colorbar class that combines IDLgrAxis and IDLgrColorbar. I've been
>> meaning to do that for a while now...
>>
>> -Mike
>
>
>
> Let me add one little addendum to this. You should be able to set the
> values you want by using the TICKVALUES and TICKTEXT as keywords as Ben
> explained. These properties along with the other TICK* keywords should
> be enough for most people. However, there have been times when I've
> needed to do additional things with the axis that couldn't be done
> through the interface in IDLgrColorbar. Since then I've always been in
> the habit of having both an IDLgrColorbar and and IDLgrAxis.
>

Hi Mike,

You probably know this already, but IDLgrColorbar has these properties
(in addition to a bunch of of others...) taken from an example instance.
They are not publicly exposed in IDL, but you could take advantage of
them the way you describe.

OAXIS OBJREF <ObjHeapVar47091(IDLGRAXIS)>
OPOLY OBJREF <ObjHeapVar47086(IDLGRPOLYLINE)>
OSURF OBJREF <NullObject>
OIMAGE OBJREF <ObjHeapVar47088(IDLGRIMAGE)>
OPALETTE OBJREF <ObjHeapVar47081(IDLGRPALETTE)>

One other thing - I mispoke a little - I actually have a colorbar that
inherits from IDLgrColorbar not IDLgrContainer which I think doesn't exist.

Cheers,
Ben
Re: GUI strategy advice needed [message #44151 is a reply to message #44150] Tue, 24 May 2005 12:32 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Wow, looks like I'm the colorbar expert all of a sudden. I typically
> don't bother with the axis within IDLgrColorbar. Instead I have an
> IDLgrColorbar object with no axis displayed and an independent IDLgrAxis
> aligned along one of the sides of the colorbar. I find this a lot
> easier to work with because I have complete control over the
> presentation of the axis.
>
> Maybe one of these days, I'll finally get around to writing my own
> colorbar class that combines IDLgrAxis and IDLgrColorbar. I've been
> meaning to do that for a while now...
>
> -Mike


Let me add one little addendum to this. You should be able to set the
values you want by using the TICKVALUES and TICKTEXT as keywords as Ben
explained. These properties along with the other TICK* keywords should
be enough for most people. However, there have been times when I've
needed to do additional things with the axis that couldn't be done
through the interface in IDLgrColorbar. Since then I've always been in
the habit of having both an IDLgrColorbar and and IDLgrAxis.

-Mike
Re: GUI strategy advice needed [message #44152 is a reply to message #44151] Tue, 24 May 2005 12:23 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Michael, since you seem to understand the IDLgrColorbar, can you give
> me a pointer? My colorbar looks great and is positioned correctly, but
> no matter what I try I can't get the tickmarks to be anything but the
> values from 0-255. In other words, I can't get the colors themselves
> to "link up" with the data values in my plot. Thanks for any help you
> can give me!
>
> Leslie Welser


Wow, looks like I'm the colorbar expert all of a sudden. I typically
don't bother with the axis within IDLgrColorbar. Instead I have an
IDLgrColorbar object with no axis displayed and an independent IDLgrAxis
aligned along one of the sides of the colorbar. I find this a lot
easier to work with because I have complete control over the
presentation of the axis.

Maybe one of these days, I'll finally get around to writing my own
colorbar class that combines IDLgrAxis and IDLgrColorbar. I've been
meaning to do that for a while now...

-Mike
Re: GUI strategy advice needed [message #44153 is a reply to message #44152] Tue, 24 May 2005 12:04 Go to previous messageGo to next message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Leslie Welser wrote:
>> Michael Wallace writes:
>> I don't mean to take this thread off subject, but what is the problem
>
>
>> with IDLgrColorbar? I've used OG colorbars in a lot of my plots and
>> never had any issue with them. So, what's not to understand? Just
>
> curious.
>
> Michael, since you seem to understand the IDLgrColorbar, can you give
> me a pointer? My colorbar looks great and is positioned correctly, but
> no matter what I try I can't get the tickmarks to be anything but the
> values from 0-255. In other words, I can't get the colors themselves
> to "link up" with the data values in my plot. Thanks for any help you
> can give me!
>

I'm sure Michael has something better up his sleeve, but I have been
manipulating the tick values by explicitly providing the tick text, ala...

datarange = [15,35.]
colorbar = obj_new('idlgrcolorbar', /show_outline, /show_axis)
colorbar->GetProperty, tickvalues = ticks
nticks = n_elements(ticks)
myTicks = FINDGEN(nTicks)/(nTicks-1) * (dataRange[1]-dataRange[0]) +
dataRange[0]
myTickString = STRTRIM(myTicks,2)
ticktext = OBJ_NEW('idlgrtext', mytickString)
colorbar->SetProperty, ticktext = ticktext
xobjview, colorbar

If you do it this way you'll want to cleanup the ticktext on your own.
I have a simple object that inherits from IDLgrContainer that cleans up
the ticktext, fonts and titles when the colorbar is destroyed. That
prevents memory leakage.

Cheers,
Ben
Re: GUI strategy advice needed [message #44154 is a reply to message #44153] Tue, 24 May 2005 11:34 Go to previous messageGo to next message
Leslie Welser is currently offline  Leslie Welser
Messages: 11
Registered: March 2005
Junior Member
> Michael Wallace writes:
> I don't mean to take this thread off subject, but what is the problem

> with IDLgrColorbar? I've used OG colorbars in a lot of my plots and
> never had any issue with them. So, what's not to understand? Just
curious.

Michael, since you seem to understand the IDLgrColorbar, can you give
me a pointer? My colorbar looks great and is positioned correctly, but
no matter what I try I can't get the tickmarks to be anything but the
values from 0-255. In other words, I can't get the colors themselves
to "link up" with the data values in my plot. Thanks for any help you
can give me!

Leslie Welser
Re: GUI strategy advice needed [message #44174 is a reply to message #44154] Mon, 23 May 2005 12:53 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Wallace writes:

> I don't know how it was back in the days before I started using IDL, but
> these days IDLgrColorbar is a subclass of IDLgrModel and you position it
> just like any other model.

Maybe that was the problem. If it doesn't have a POSITION
keyword, I struggle. :-(

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: GUI strategy advice needed [message #44175 is a reply to message #44174] Mon, 23 May 2005 12:40 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> I don't know. It just doesn't seem to work in the "Coyote Way". :-(
>
> I haven't used it in awhile, but I remember I had a devil of a time
> positioning it in my view.


I don't know how it was back in the days before I started using IDL, but
these days IDLgrColorbar is a subclass of IDLgrModel and you position it
just like any other model.

-Mike
Re: GUI strategy advice needed [message #44178 is a reply to message #44175] Mon, 23 May 2005 09:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Wallace writes:

> I don't mean to take this thread off subject, but what is the problem
> with IDLgrColorbar? I've used OG colorbars in a lot of my plots and
> never had any issue with them. So, what's not to understand? Just curious.

I don't know. It just doesn't seem to work in the "Coyote Way". :-(

I haven't used it in awhile, but I remember I had a devil of a time
positioning it in my view.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: GUI strategy advice needed [message #44180 is a reply to message #44178] Mon, 23 May 2005 09:20 Go to previous messageGo to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Direct graphics and object graphics are two completely
> incompatible graphics sub-systems. You cannot mix and
> match in the same graphics window. You could, of course,
> use OG colorbars. I've never understood RSI's OG colorbar
> either, but I have a couple of my web page that may work
> more like what you are expecting. If you go the OG approach,
> you will have to modify all the other things you have done, too.

I don't mean to take this thread off subject, but what is the problem
with IDLgrColorbar? I've used OG colorbars in a lot of my plots and
never had any issue with them. So, what's not to understand? Just curious.

-Mike
Re: GUI strategy advice needed [message #44181 is a reply to message #44180] Mon, 23 May 2005 09:03 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Soren writes:

> Thanks for your advice. Yes, lernig OG was also a part of the reason why I
> chose that solution.
> I downloaded your vcolorbar and it is easily controllable, but i have
> problem using it in a indexed color mode window. I tried to set grey to 1:
> thisImage = Obj_New('IDLgrImage', bar, greyscale=1)
> as the image is created, but it seems to always just render in one color,
> maybe you have a quick fix?

Well, I wouldn't be using an indexed color mode window!
Why are you doing that!? Doesn't that sort of defeat
the whole point of using object graphics? :-)

Anyway, leaving for Germany in a matter of hours
and still lots to be done. But I'm not sure there
is a quick fix.


> Thanks for your help!
> Bought your book by the way, it's been well worth the investment many times.

My wife told me I should have charged double for it. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: GUI strategy advice needed [message #44185 is a reply to message #44181] Mon, 23 May 2005 08:46 Go to previous messageGo to next message
n is currently offline  n
Messages: 5
Registered: January 2005
Junior Member
Hello David,
Thanks for your advice. Yes, lernig OG was also a part of the reason why I
chose that solution.
I downloaded your vcolorbar and it is easily controllable, but i have
problem using it in a indexed color mode window. I tried to set grey to 1:
thisImage = Obj_New('IDLgrImage', bar, greyscale=1)
as the image is created, but it seems to always just render in one color,
maybe you have a quick fix?

Thanks for your help!
Bought your book by the way, it's been well worth the investment many times.

Soren


"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.1cfb7bab16f3879d989a17@news.frii.com...
> Soren writes:
>
>> I am building a GUI for image display with the following specifications.
>> 1) Choice of colormap
>> 2) Colorbar
>> 3) Window/level setting by mouse drag
>> 4) Scalable display
>> 5) Print function
>> 6) ROI functionality (segmeneted polygon only, multiple ROIs)
>>
>> I had the first 5 done using direct graphics. (2) and (4) using David
>> Fannings colorbar and print routines.
>>
>> I figured that the ROI function was best implemented using Object
>> graphics
>> (OG) as i saw XROI and figured that i then didn't have to worry about a
>> lot
>> of the drawing myself.
>>
>> I was happy with the OG approach until implementing the colorbar using
>> OG.
>> It seems the documentaton is erroneus, or at least i cannot seem to
>> control
>> the colorbar layout.
>>
>> 1) The questions in now - should i stick to OG and is there some way to
>> get
>> Davids colorbar into an OG window.
>> I would like to keep things simple and have all graphics in one window -
>> it
>> makes printing easier.
>
> Direct graphics and object graphics are two completely
> incompatible graphics sub-systems. You cannot mix and
> match in the same graphics window. You could, of course,
> use OG colorbars. I've never understood RSI's OG colorbar
> either, but I have a couple of my web page that may work
> more like what you are expecting. If you go the OG approach,
> you will have to modify all the other things you have done, too.
>
>> 2) Am i right that multiple ROIs are best managed using OG?
>
> No, I doubt it. You may be right that ROIs are best
> managed by objects, but I've never had any trouble at
> all using direct graphics objects to implement all the
> functionality you talk about. I do often find the IDLanROI
> object useful for computing geometry, etc. But I usually
> draw the objects in direct graphics.
>
> I do see the RSI train a'comin', however, and realize that
> anyone committed to direct graphics is going to be
> run over or left in the dust. What you see is what you
> are going to get forever with direct graphics. All the
> innovations (i.e., what you are paying your maintenance dollars
> for) are going to be in the object graphics realm. Maybe
> you would be further ahead to take this as an opportunity
> to learn object graphics.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: GUI strategy advice needed [message #44189 is a reply to message #44185] Mon, 23 May 2005 05:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Soren writes:

> I am building a GUI for image display with the following specifications.
> 1) Choice of colormap
> 2) Colorbar
> 3) Window/level setting by mouse drag
> 4) Scalable display
> 5) Print function
> 6) ROI functionality (segmeneted polygon only, multiple ROIs)
>
> I had the first 5 done using direct graphics. (2) and (4) using David
> Fannings colorbar and print routines.
>
> I figured that the ROI function was best implemented using Object graphics
> (OG) as i saw XROI and figured that i then didn't have to worry about a lot
> of the drawing myself.
>
> I was happy with the OG approach until implementing the colorbar using OG.
> It seems the documentaton is erroneus, or at least i cannot seem to control
> the colorbar layout.
>
> 1) The questions in now - should i stick to OG and is there some way to get
> Davids colorbar into an OG window.
> I would like to keep things simple and have all graphics in one window - it
> makes printing easier.

Direct graphics and object graphics are two completely
incompatible graphics sub-systems. You cannot mix and
match in the same graphics window. You could, of course,
use OG colorbars. I've never understood RSI's OG colorbar
either, but I have a couple of my web page that may work
more like what you are expecting. If you go the OG approach,
you will have to modify all the other things you have done, too.

> 2) Am i right that multiple ROIs are best managed using OG?

No, I doubt it. You may be right that ROIs are best
managed by objects, but I've never had any trouble at
all using direct graphics objects to implement all the
functionality you talk about. I do often find the IDLanROI
object useful for computing geometry, etc. But I usually
draw the objects in direct graphics.

I do see the RSI train a'comin', however, and realize that
anyone committed to direct graphics is going to be
run over or left in the dust. What you see is what you
are going to get forever with direct graphics. All the
innovations (i.e., what you are paying your maintenance dollars
for) are going to be in the object graphics realm. Maybe
you would be further ahead to take this as an opportunity
to learn object graphics.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: GUI strategy advice needed [message #44244 is a reply to message #44149] Wed, 25 May 2005 04:25 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Michael Wallace wrote:
>> You probably know this already, but IDLgrColorbar has these properties
>> (in addition to a bunch of of others...) taken from an example
>> instance. They are not publicly exposed in IDL, but you could take
>> advantage of them the way you describe.
>
>
> I shy away from using things that are not in the public API. While what
> you say is true, it has a greater potential to lead to code that is hard
> to understand and maintain, especially if someone else is doing the
> understanding and maintaining. I'm a purist when it comes to coding
> style and I'll always try to fit into the public API, no matter the
> language being used. Going beyond the API is an absolute last resort.
>

Hi Mike,

Yes, I agree with you.

Cheers,
Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: help: window content erased after resize
Next Topic: OVERPLOT POINTS IN CONTOUR

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:23:38 PDT 2025

Total time taken to generate the page: 0.00909 seconds