Re: [visad] Strange rendering depending on axis range

Respected Tom Rink Sir and Tomas Pluskal Sir.

I have tried to access the latest visad source code from the SVN.
And added support into byRef renderer to take care
Range->ZAxis and Range->RGB Mapping.


Pluskal Sir, kindly preseve the current jar file and
update your jar with the attached class file, it should work for you.
Use jar command with -uvf option.

Attached herewith the modified program VisadTestDump.java.
I am putting the class file on ftp.ssec.wisc.edu/pub/incoming.
I am not able to send it through my office mail.

Kindly see my comments in the program.

Sort of a disclaimer notice, but still to say.
This is just a TEMPORARY (NOT PROPERLY TESTED) SOLUTION but still QUITE EFFICIENT ;-).

Just give it a try.

I hope it helps you a bit.

with regards
Ghansham

On 05/25/2012 11:30 PM, visad-request@xxxxxxxxxxxxxxxx wrote:
Send visad mailing list submissions to
        visad@xxxxxxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        http://mailman.unidata.ucar.edu/mailman/listinfo/visad
or, via email, send a message with subject or body 'help' to
        visad-request@xxxxxxxxxxxxxxxx

You can reach the person managing the list at
        visad-owner@xxxxxxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of visad digest..."


Today's Topics:

    1. Re: Strange rendering depending on axis range (Tom Rink)
    2. Re: Strange rendering depending on axis range (Tomas Pluskal)


----------------------------------------------------------------------

Message: 1
Date: Fri, 25 May 2012 00:16:39 -0500
From: Tom Rink<rink@xxxxxxxxxxxxx>
To: visad@xxxxxxxxxxxxxxxx
Subject: Re: [visad] Strange rendering depending on axis range
Message-ID:<4FBF15B7.70709@xxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

On 5/25/12 12:00 AM, Tomas Pluskal wrote:
Hi Tom,

I was experimenting with your VisadTest.java source, and discovered this:

                         double xMin = 1.0;
                         double xMax = 1.0007;
                         double yMin = 0.0;
                         double yMax = 100.0;
                         int xRes = 1000;
                         int yRes = 10;

formally setting the ranges to decimal values fixes the problem for me.
We are visualizing mass spectrometry data, and if the user wants to
plot a single mass signal, we need to visualize a narrow range of m/z
values, such as 179.0551 ~ 179.0558.

1.0  to 1.00007  did not work, I think this can be expected.
Hmm, why this can be expected?
0.00007/1000 is possibly too small for float precision.



Tomas


===============================================
Tom?s( Pluskal
G0 Cell Unit, Okinawa Institute of Science and Technology Graduate
University
1919-1 Tancha, Onna-son, Okinawa 904-0495, Japan
TEL: +81-98-966-8684
Fax: +81-98-966-2890



_______________________________________________
visad mailing list
visad@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:<http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20120525/ddf98eaa/attachment.html>

------------------------------

Message: 2
Date: Fri, 25 May 2012 05:41:16 +0000
From: Tomas Pluskal<pluskal@xxxxxxx>
To: "visad@xxxxxxxxxxxxxxxx"<visad@xxxxxxxxxxxxxxxx>
Subject: Re: [visad] Strange rendering depending on axis range
Message-ID:<DD0D6ACD-8B55-4FA4-BAC0-EB8B2B5D7640@xxxxxxx>
Content-Type: text/plain; charset="windows-1252"


0.00007/1000 is possibly too small for float precision.

I see.

But 7000 / 10000 is not that small... (xMin = 10000000, xMax = 10007000, xRes = 
10000 shows the same issue).

Tomas


===============================================
Tom?? Pluskal
G0 Cell Unit, Okinawa Institute of Science and Technology Graduate University
1919-1 Tancha, Onna-son, Okinawa 904-0495, Japan
TEL: +81-98-966-8684
Fax: +81-98-966-2890

-------------- next part --------------
An HTML attachment was scrubbed...
URL:<http://mailman.unidata.ucar.edu/mailing_lists/archives/visad/attachments/20120525/4d2b06d0/attachment.html>

------------------------------

_______________________________________________
visad mailing list
visad@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/

End of visad Digest, Vol 30, Issue 11
*************************************


import java.awt.Color;
import java.awt.Component;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;

import javax.swing.JFrame;

import visad.DataReferenceImpl;
import visad.Display;
import visad.FlatField;
import visad.FunctionType;
import visad.GraphicsModeControl;
import visad.Linear2DSet;
import visad.RealTupleType;
import visad.RealType;
import visad.ScalarMap;
import visad.ConstantMap;
import visad.java3d.DisplayImplJ3D;
import visad.java3d.DisplayRendererJ3D;
import visad.bom.ImageRendererJ3D;

public class VisadTestDump {

        public static void main(String[] args) {

                try {
                        double xMin = 100;
                        double xMax = 1000;
                        double yMin = 0;
                        double yMax = 30;
                        int xRes = 1000;
                        int yRes = 1000;
                        //Use this property to set Texture ByReference 
Rendering for images
                        System.setProperty(visad.ShadowType.PROP_IMAGE_BY_REF, 
"true");
                        //Optional:Just try to uncomment this. If your graphics 
card supports NPOT
                        //textures. You may save up a lot of memory.
                        
//System.setProperty(visad.java3d.DisplayImplJ3D.PROP_TEXTURE_NPOT, "true");

                        float[][] zValues = new float[1][xRes * yRes];

                        File f = new File("datasetdump");
                        FileInputStream fs = new FileInputStream(f);
                        DataInputStream ds = new DataInputStream(fs);
                        for (int i = 0; i < zValues[0].length; i++) {
                                zValues[0][i] = (float)ds.readDouble();
                        }
                        ds.close();

                        RealType xType = RealType.getRealType("x");
                        RealType yType = RealType.getRealType("y");
                        RealType zType = RealType.getRealType("z");
                        RealTupleType domainTuple = new RealTupleType(xType, 
yType);
                        FunctionType func = new FunctionType(domainTuple, 
zType);

                        ScalarMap xMap = new ScalarMap(xType, Display.XAxis);
                        ScalarMap yMap = new ScalarMap(yType, Display.YAxis);
                        ScalarMap zMap = new ScalarMap(zType, Display.ZAxis);
                        ScalarMap colorMap = new ScalarMap(zType, Display.RGB);

                        DisplayImplJ3D display = new DisplayImplJ3D("display");

                        display.addMap(xMap);
                        display.addMap(yMap);
                        display.addMap(zMap);
                        display.addMap(colorMap);

                        xMap.setRange(xMin, xMax);

                        Linear2DSet domainSet = new Linear2DSet(domainTuple, 
xMin, xMax,
                                        xRes, yMin, yMax, yRes);

                        FlatField flatField = new FlatField(func, domainSet);
                        flatField.setSamples(zValues, false);
                        DataReferenceImpl dataReference = new 
DataReferenceImpl("data");
                        dataReference.setData(flatField);
                        //Adding constant Map:Dont use value less than 1
                        ConstantMap cmap[] = {new ConstantMap(1.0f, 
Display.CurvedSize)};
                        //Use ImageRendererJ3D than using Default Renderer
                        display.addReferences(new ImageRendererJ3D(), 
dataReference, cmap);
                        //display.addReference(dataReference);

                        DisplayRendererJ3D dRenderer = (DisplayRendererJ3D) 
display
                                        .getDisplayRenderer();
                        dRenderer.setForegroundColor(Color.black);
                        dRenderer.setBackgroundColor(Color.white);
                        dRenderer.setBoxOn(true);

                        GraphicsModeControl graphicsModeControl = display 
.getGraphicsModeControl();
                        graphicsModeControl.setScaleEnable(true);
                        //graphicsModeControl.setTextureEnable(false);

                        JFrame newFrame = new JFrame();
                        Component component = display.getComponent();
                        newFrame.getContentPane().add(component);
                        newFrame.pack();
                        newFrame.setVisible(true);

                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

}
  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: