Image Object Scaling Bug [message #9257] |
Sat, 14 June 1997 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Image Object Scaling Bug
Name: David Fanning
E-mail Address: davidf@dfanning.com
IDL version: { x86 Win32 Windows 5.0 Apr 28 1997}
Platform and OS: WindowsNT 4.0, Service Pack 1
Description of Problem:
Quite often in object graphics you want to scale image data into
the range of 0 to 1. (For example, you might want to put axes on the
image.) Reading the documentation, you might try something like this:
s = Size(image)
xsize = s(1)
ysize = s(2)
xs = Norm_Coord([0,xsize])
ys = Norm_Coord([0,ysize])
thisImage = ('IDLgrImage, image, XCoord_Conv=xs, YCoord_Conv=ys)
Ignoring the fact that Norm_Coord needs modification (see below) and
will return scaling factors of 0 if called like this, this formulation
doesn't work. This is because the keywords XCoord_Conv and YCoord_Conv
have been implemented incorrectly on the image object.
Known Workarounds or Fixes:
The workaround is to put the image data into its own model, which
is then scaled into the correct range. The code looks like this:
s = Size(image)
xsize = s(1)
ysize = s(2)
xs = Norm_Coord([0,xsize])
ys = Norm_Coord([0,ysize])
thisImage = ('IDLgrImage, image)
imageModel = ('IDLgrModel')
imageModel->Add, thisImage
imageModel->Scale, 1.0/xsize, 1.0/ysize, 1
RSI Technical Support Response: Fixed and available in next release.
Norm_Coord Program Needs Modification
Name: David Fanning
E-mail Address: davidf@dfanning.com
IDL version: { x86 Win32 Windows 5.0 Apr 28 1997}
Platform and OS: WindowsNT 4.0, Service Pack 1
Description of Problem:
The Norm_Coord program supplied in the IDL50/examples/objects
directory is written so that it requires floating point input
values to work correctly. To avoid problems, the code should be
rewritten (and renamed so that it works under 8.3 naming
conventions) like this:
FUNCTION NORMAL, range
; This function takes a range vector [min, max] as contained
; in the [XYZ]RANGE property of an object and converts it to
; a scaling vector (suitable for the [XYZ]COORD_CONV property)
; that scales the object to fit in the range [0,1].
scale = [-FLOAT(range[0])/(range[1]-range[0]), $
1.0/(range[1]-range[0])]
RETURN, scale
END
RSI Technical Support Response: Fixed and available in next release.
------------------------------------------------------------ -----------
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
IDL 5 Reports: http://www.dfanning.com/documents/anomaly5.html
|
|
|