Re: [visad] Help!!! Domain Image...

  • To: "Marco Aurélio Silva Neto" <mneto@xxxxxxxxxx>
  • Subject: Re: [visad] Help!!! Domain Image...
  • From: "Curtis Rueden" <ctrueden@xxxxxxxx>
  • Date: Mon, 17 Mar 2008 11:34:54 -0500
Hi Marco,

How do I amended the domain of an image?
>

If you want to alter the domain set of the image, you can construct a new
FlatField with a different domain set (e.g., a Gridded2DSet with an
irregularly spaced grid, instead of the Integer2DSet that GIFForm normally
delivers). Then call getFloats or getValues on your original dataset to get
the range values, and pass them to the new FlatField's setSamples method.


> I wonder as I do, for example, to use the function Linear2DSet to change
> the domain of image (position and size, for example).
>

Indeed, using a Linear2DSet should work to change the position and/or scale
of your image data.

And if you want to change the *resolution* of your data, try calling
FieldImpl's resample method.

-Curtis

On Fri, Mar 14, 2008 at 7:24 AM, Marco Aurélio Silva Neto <mneto@xxxxxxxxxx>
wrote:

> How do I amended the domain of an image?
>
> I am using the following code to generate the image ...
>
> My Code ...
>
>           RealType longitude;
>           RealType latitude;
>           RealType redType;
>           RealType greenType;
>           RealType blueType;
>           DataReferenceImpl data_ref;
>           ScalarMap redMap;
>           ScalarMap greenMap;
>           ScalarMap blueMap;
>           ScalarMap lonXMap;
>           ScalarMap latYMap;
>
>           GIFForm image = new GIFForm();
>           DataImpl imageData
> =image.open("/home/mneto/Desktop/teste5.jpg");
>                     FunctionType functionType = (FunctionType)
> imageData.getType();
>
>           RealTupleType domain = (RealTupleType) functionType.getDomain();
>           RealTupleType range = (RealTupleType) functionType.getRange();
>
>           longitude = (RealType) domain.getComponent(0);
>           latitude = (RealType) domain.getComponent(1);
>
>           redType = (RealType) range.getComponent(0);
>           greenType = (RealType) range.getComponent(1);
>           blueType = (RealType) range.getComponent(2);
>
>           lonXMap = new ScalarMap(longitude, Display.XAxis);
>           latYMap = new ScalarMap(latitude, Display.YAxis);
>
>           redMap = new ScalarMap(redType, Display.Red);
>           greenMap = new ScalarMap(greenType, Display.Green);
>           blueMap = new ScalarMap(blueType, Display.Blue);
>
>
>           display.addMap(lonXMap);
>           display.addMap(latYMap);
>           display.addMap(redMap);
>           display.addMap(greenMap);
>           display.addMap(blueMap);
>
>           data_ref = new DataReferenceImpl("image_ref");
>
>           data_ref.setData(imageData);
>
>           display.addReference(data_ref);
>
> I wonder as I do, for example, to use the function Linear2DSet to change
> the domain of image (position and size, for example).
>
> Grateful
>
> Marco
> _______________________________________________
> visad mailing list
> visad@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: