|
|
|
|
|
Re: GUI strategy advice needed [message #44153 is a reply to message #44152] |
Tue, 24 May 2005 12:04   |
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 #44181 is a reply to message #44180] |
Mon, 23 May 2005 09:03   |
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   |
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   |
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  |
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
|
|
|