Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

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

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/
>
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690