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

Home » Public Forums » archive » How can I force the x=image(...) command to give me a window that is the same size as my image?
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
How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88574] Tue, 13 May 2014 16:16 Go to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
Here is my code:


im1=image(big_img,dimensions=n_elements(big_img[*,0]),n_elem ents(big_img[0,*])],window_title=slitname+'-+filtername,max_ value=highval,min_value=lowval,margin=[0,0,0,0],location=[0, 0],/xstyle,/ystyle)

I've explicitly given it dimensions, margin, and location. I even threw in xstyle and ystyle for good measure. It seems like there is always HUGE white space above and below my actual image. Its never in the x direction, only in the y direction.

This is an issue because I want the exact location on the image where someone clicks and if there is whitespace

I'm on mac os 10.8 if that changes anything.
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88576 is a reply to message #88574] Wed, 14 May 2014 00:35 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Well, let's begin with the fact that the line of code you gave is full of errors... that said, this works fine for me:
big_img = dist(512)
mx = max(big_img, min=mn)
im1=image(big_img,dimensions=size(big_img,/dimensions),windo w_title='title',max_value=mx,min_value=mn,margin=[0,0,0,0],l ocation=[0,0],/xstyle,/ystyle)

> I'm on mac os 10.8 if that changes anything.

Don't know about the mac, but maybe the idl version counts.

IDL> !version
{
ARCH: "x86_64",
OS: "Win32",
OS_FAMILY: "Windows",
OS_NAME: "Microsoft Windows",
RELEASE: "8.3",
BUILD_DATE: "Nov 15 2013",
MEMORY_BITS: 64,
FILE_OFFSET_BITS: 64
}

Cheers,
Helder
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88582 is a reply to message #88576] Wed, 14 May 2014 12:24 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 12:35:23 AM UTC-7, Helder wrote:
> Well, let's begin with the fact that the line of code you gave is full of errors... that said, this works fine for me:
>
> big_img = dist(512)
>
> mx = max(big_img, min=mn)
>
> im1=image(big_img,dimensions=size(big_img,/dimensions),windo w_title='title',max_value=mx,min_value=mn,margin=[0,0,0,0],l ocation=[0,0],/xstyle,/ystyle)
>
>
>
>> I'm on mac os 10.8 if that changes anything.
>
>
>
> Don't know about the mac, but maybe the idl version counts.
>
>
>
> IDL> !version
>
> {
>
> ARCH: "x86_64",
>
> OS: "Win32",
>
> OS_FAMILY: "Windows",
>
> OS_NAME: "Microsoft Windows",
>
> RELEASE: "8.3",
>
> BUILD_DATE: "Nov 15 2013",
>
> MEMORY_BITS: 64,
>
> FILE_OFFSET_BITS: 64
>
> }
>
>
>
> Cheers,
>
> Helder

I see no whitespace with this square image, but try it with

big_img = findgen(1000,100)
mx = max(big_img, min=mn)
im1=image(big_img,dimensions=size(big_img,/dimensions),windo w_title='title',max_value=mx,min_value=mn,margin=[0,0,0,0],l ocation=[0,0],/xstyle,/ystyle)

This makes a rectangular window with whitespace at the top and bottom.

my IDL version

{ x86_64 darwin unix Mac OS X 8.2 Apr 10 2012 64 64}


Hmmm. Is it a factor if I'm using the idlde? It seems to show a window with no whitespace when run from the command line, but there is whitespace when I'm using idlde.... Is there a way to fix this?
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88583 is a reply to message #88582] Wed, 14 May 2014 13:55 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Wednesday, May 14, 2014 2:24:23 PM UTC-5, myname...@gmail.com wrote:
> On Wednesday, May 14, 2014 12:35:23 AM UTC-7, Helder wrote:
>> big_img = dist(512)
>> mx = max(big_img, min=mn)
>> im1=image(big_img,dimensions=size(big_img,/dimensions),windo w_title='title',max_value=mx,min_value=mn,margin=[0,0,0,0],l ocation=[0,0],/xstyle,/ystyle)
> Hmmm. Is it a factor if I'm using the idlde? It seems to show a window with no whitespace when run from the command line, but there is whitespace when I'm using idlde.... Is there a way to fix this?

The code from Helder works fine for me in idlde, no whitespace. OS 10.9.2.

IDL> help, !VERSION
** Structure !VERSION, 8 tags, length=104, data length=100:
ARCH STRING 'x86_64'
OS STRING 'darwin'
OS_FAMILY STRING 'unix'
OS_NAME STRING 'Mac OS X'
RELEASE STRING '8.2.3'
BUILD_DATE STRING 'May 2 2013'
MEMORY_BITS INT 64
FILE_OFFSET_BITS
INT 64
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88584 is a reply to message #88583] Wed, 14 May 2014 13:57 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 1:55:33 PM UTC-7, Phillip Bitzer wrote:
> On Wednesday, May 14, 2014 2:24:23 PM UTC-5, myname...@gmail.com wrote:
>
>> On Wednesday, May 14, 2014 12:35:23 AM UTC-7, Helder wrote:
>
>>> big_img = dist(512)
>
>>> mx = max(big_img, min=mn)
>
>>> im1=image(big_img,dimensions=size(big_img,/dimensions),windo w_title='title',max_value=mx,min_value=mn,margin=[0,0,0,0],l ocation=[0,0],/xstyle,/ystyle)
>
>> Hmmm. Is it a factor if I'm using the idlde? It seems to show a window with no whitespace when run from the command line, but there is whitespace when I'm using idlde.... Is there a way to fix this?
>
>
>
> The code from Helder works fine for me in idlde, no whitespace. OS 10.9.2.
>
>
>
> IDL> help, !VERSION
>
> ** Structure !VERSION, 8 tags, length=104, data length=100:
>
> ARCH STRING 'x86_64'
>
> OS STRING 'darwin'
>
> OS_FAMILY STRING 'unix'
>
> OS_NAME STRING 'Mac OS X'
>
> RELEASE STRING '8.2.3'
>
> BUILD_DATE STRING 'May 2 2013'
>
> MEMORY_BITS INT 64
>
> FILE_OFFSET_BITS
>
> INT 64

Helder's code also worked with no whitespace for me, but the problem seems to happen with long rectangular images. Did you try it with big_img = findgen(1000,100) ?
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88585 is a reply to message #88584] Wed, 14 May 2014 14:05 Go to previous messageGo to next message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
On Wednesday, May 14, 2014 3:57:44 PM UTC-5, myname...@gmail.com wrote:

> Helder's code also worked with no whitespace for me, but the problem seems to happen with long rectangular images. Did you try it with big_img = findgen(1000,100) ?

Sorry, I missed this. But your big_img does work fine, i.e., no whitespace, for me as well.
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88586 is a reply to message #88585] Wed, 14 May 2014 14:31 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, May 14, 2014 3:05:27 PM UTC-6, Phillip Bitzer wrote:
> On Wednesday, May 14, 2014 3:57:44 PM UTC-5, myname...@gmail.com wrote:
>
>
>
>> Helder's code also worked with no whitespace for me, but the problem seems to happen with long rectangular images. Did you try it with big_img = findgen(1000,100) ?
>
>
>
> Sorry, I missed this. But your big_img does work fine, i.e., no whitespace, for me as well.

Just to chime in, I think in IDL 8.3 and earlier, there was a hardcoded limit on the X and Y dimensions of the window. For the X dimension it was something like 450 pixels, while for Y it was 50 pixels.

If you are still having problems, you might try adding the /WIDGET keyword, to force IDL widgets instead of Java SWT widgets.

Also, even if you do end up with whitespace, why can't you use the ConvertCoord method to determine if the mouse click location is on or off the image?

-Chris
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88587 is a reply to message #88585] Wed, 14 May 2014 14:35 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Phillip Bitzer writes:

> Sorry, I missed this. But your big_img does work fine, i.e., no whitespace, for me as well.

Same version of IDL that Philip is using, and without having any windows
open, this code produces a window with white space top and bottom:

big_img = dist(512, 248)
mx = max(big_img, min=mn)
im1=image(big_img,dimensions=size
(big_img,/dimensions),window_title='title',max_value=mx,min_ value=mn,mar
gin=[0,0,0,0],location=[0,0],/xstyle,/ystyle)

It is as though the image refuses to give up its image aspect ratio.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88588 is a reply to message #88586] Wed, 14 May 2014 14:39 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris Torrence writes:

> If you are still having problems, you might try adding the /WIDGET keyword, to force IDL widgets instead of Java SWT widgets.

I find it comes up properly in a widget window, but goes back to showing
white space as soon as the window is resized.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88589 is a reply to message #88586] Wed, 14 May 2014 14:51 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 2:31:59 PM UTC-7, Chris Torrence wrote:
> On Wednesday, May 14, 2014 3:05:27 PM UTC-6, Phillip Bitzer wrote:
>
>> On Wednesday, May 14, 2014 3:57:44 PM UTC-5, myname...@gmail.com wrote:
>
>>
>
>>
>
>>
>
>>> Helder's code also worked with no whitespace for me, but the problem seems to happen with long rectangular images. Did you try it with big_img = findgen(1000,100) ?
>
>>
>
>>
>
>>
>
>> Sorry, I missed this. But your big_img does work fine, i.e., no whitespace, for me as well.
>
>
>
> Just to chime in, I think in IDL 8.3 and earlier, there was a hardcoded limit on the X and Y dimensions of the window. For the X dimension it was something like 450 pixels, while for Y it was 50 pixels.
>
>
>
> If you are still having problems, you might try adding the /WIDGET keyword, to force IDL widgets instead of Java SWT widgets.
>
>
>
> Also, even if you do end up with whitespace, why can't you use the ConvertCoord method to determine if the mouse click location is on or off the image?
>
>
>
> -Chris

I think the /widget keyword is doing what I want. I also noticed a slight difference in the appearance of the windows using idlde and just idl from a command line. it looks like running it from a command line automatically opens it up as a widget.

The convert_coord function would work, but another issue is that some people using the software have much smaller monitors than I do, and the images are taking up much more space, which ends up being a problem itself sometimes :)
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88590 is a reply to message #88588] Wed, 14 May 2014 14:59 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 2:39:06 PM UTC-7, David Fanning wrote:
> Chris Torrence writes:
>
>
>
>> If you are still having problems, you might try adding the /WIDGET keyword, to force IDL widgets instead of Java SWT widgets.
>
>
>
> I find it comes up properly in a widget window, but goes back to showing
>
> white space as soon as the window is resized.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

I can just instruct everyone using this software to not resize the windows... problem solved, right?

Though the whitespace was more of a "taking up too much monitor space" or (for people with large monitors) an aesthetic issue, really.
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88591 is a reply to message #88590] Wed, 14 May 2014 15:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mynameismunka@gmail.com writes:

>
> I can just instruct everyone using this software to not resize the windows... problem solved, right?
>
> Though the whitespace was more of a "taking up too much monitor space" or (for people with large monitors) an aesthetic issue, really.

There is always cgImage. That works correctly. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88592 is a reply to message #88591] Wed, 14 May 2014 15:12 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 3:02:47 PM UTC-7, David Fanning wrote:
> mynameismunka@gmail.com writes:
>
>
>
>>
>
>> I can just instruct everyone using this software to not resize the windows... problem solved, right?
>
>>
>
>> Though the whitespace was more of a "taking up too much monitor space" or (for people with large monitors) an aesthetic issue, really.
>
>
>
> There is always cgImage. That works correctly. :-)
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Would my MOUSE_DOWN_HANDLER still work?

Like this:

im1.window.MOUSE_DOWN_HANDLER='MouseDown'
im1.window.MOUSE_UP_HANDLER='MouseUp'
im1.window.Keyboard_Handler='KeyboardHandler'
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88593 is a reply to message #88592] Wed, 14 May 2014 15:23 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mynameismunka@gmail.com writes:

> Would my MOUSE_DOWN_HANDLER still work?
>
> Like this:
>
> im1.window.MOUSE_DOWN_HANDLER='MouseDown'
> im1.window.MOUSE_UP_HANDLER='MouseUp'
> im1.window.Keyboard_Handler='KeyboardHandler'

The program cgCmdWindow (cgWindow is a wrapper for this program) is
already set up for handling widget events. You simply need to write your
own event handler for the program, tell it what events you want it to
handle (button events, for example), and off you go. It is incredibly
simple and simple-minded. Probably why it works so well. ;-)

You don't program it with "handlers", rather you just respond to the
events themselves. Widget Programming 101, really.

If you didn't want to do it yourself, it might take 15 minutes for me to
code something up for you. The program cgCmdWindow is basically a draw
widget that knows how to "execute" IDL graphics commands that are added
to it. Commands like cgImage.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88594 is a reply to message #88593] Wed, 14 May 2014 16:10 Go to previous messageGo to next message
munka is currently offline  munka
Messages: 36
Registered: December 2009
Member
On Wednesday, May 14, 2014 3:23:25 PM UTC-7, David Fanning wrote:
> mynameismunka@gmail.com writes:
>
>
>
>> Would my MOUSE_DOWN_HANDLER still work?
>
>>
>
>> Like this:
>
>>
>
>> im1.window.MOUSE_DOWN_HANDLER='MouseDown'
>
>> im1.window.MOUSE_UP_HANDLER='MouseUp'
>
>> im1.window.Keyboard_Handler='KeyboardHandler'
>
>
>
> The program cgCmdWindow (cgWindow is a wrapper for this program) is
>
> already set up for handling widget events. You simply need to write your
>
> own event handler for the program, tell it what events you want it to
>
> handle (button events, for example), and off you go. It is incredibly
>
> simple and simple-minded. Probably why it works so well. ;-)
>
>
>
> You don't program it with "handlers", rather you just respond to the
>
> events themselves. Widget Programming 101, really.
>
>
>
> If you didn't want to do it yourself, it might take 15 minutes for me to
>
> code something up for you. The program cgCmdWindow is basically a draw
>
> widget that knows how to "execute" IDL graphics commands that are added
>
> to it. Commands like cgImage.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

I probably need to take Widget Programming 101 :) I'll look into this, but I think for now, its best to stick with what I know works.
Re: How can I force the x=image(...) command to give me a window that is the same size as my image? [message #88595 is a reply to message #88594] Wed, 14 May 2014 17:06 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mynameismunka@gmail.com writes:

> I probably need to take Widget Programming 101 :) I'll look into this, but I think for now, its best to stick with what I know works.

Or, doesn't, as the case may be. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to set error bar thickness in ERRORPLOT()?
Next Topic: Trouble resizing image

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

Current Time: Wed Oct 08 15:15:53 PDT 2025

Total time taken to generate the page: 0.06689 seconds