[GRASS-dev] wxNviz volumes

Hi Anna,

Martin's fix allowed me to get wxNviz going and try it out. Your summer work has make great improvements in getting this to the level of functionality of the old tcltk nviz. The view controls work very well and the map updates automatically. The data controls work well too and alter the image as indicated. The lighting works really well too and I'm glad to see the cutting plane and fringe functional. This is all very much appreciated. I have a few observations and suggestions from going through and testing.

1. Position controls. Works fine. But this seems to make more sense on the view page as it affects the orientation of the map display rather than the color or character of the image itself (other things on the data page).

2. Z-exag. Works fine. It would be nice if this could be a float with at least 1 decimal so that z-exag. of 1.5 or 2.5 could be set. Not a high priority though.

3. Cutting plane. Most works fine. But the x and y sliders seem to do the same thing. Height doesn't seem to have any affect. Tilt make visual cutting planes disappear (same thing with TclTk).

4. Fringe. All works well except the 'elevation from bottom' command. It doesn't seem to do anything.

I'll check on the volumes next.

Thanks for all your work.

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Jul 1, 2011, at 8:54 PM, <grass-dev-request@lists.osgeo.org> wrote:

Date: Fri, 1 Jul 2011 23:16:22 -0400
From: Helena Mitasova <hmitaso@ncsu.edu>
Subject: Re: [GRASS-dev] wxNviz volumes
To: Anna Kratochv?lov? <KratochAnna@seznam.cz>
Cc: Martin Landa <landa.martin@gmail.com>, GRASS developers list
       <grass-dev@lists.osgeo.org>
Message-ID: <6A39F8F7-9EB1-4151-9BEB-69D8603F3284@ncsu.edu>
Content-Type: text/plain; charset=windows-1252

On Jul 1, 2011, at 10:00 AM, Anna Kratochv?lov? wrote:

Hello,

- I tried volumes in wxnviz but I did not get too far - the GUI does not see any
of my 3d rasters -
the browser for 3D raster maps shows the mapsets but nothing in them

It should be ok now.

It still does not work for me - when I am setting the 3D region (from set region to match this 3D raster) they show up,
but not when I try to add it under wxnviz>Volume. Am I missing something? Should I be adding them as map layers
first somewhere?

I haven't tested volumes yet, but I saw that "slices" are not implemented yet, is this another name for cross-sections or it's another functionality?

It is crossections - we called them slices because you are "slicing" through the volume
but I guess that cross-sections is a more appropriate term - I have a few examples here:
http://skagit.meas.ncsu.edu/~helena/publwork/MitSTCfigs2.ppt
It is pretty important part of volume visualization.

- there appears to be an issue with automatic loading of raster when opening the
Data Tab:
-- I have map1 and map2 in GIS manager.
-- I switch off map1 but I keep map2 on
-- switch view to 3d.
-- wxnviz opens correctly with map2
-- when I switch to tab Data, map1 is loaded as raster map - I would have
expected map2
--I tried with more rasters and it looks like it
always picks up the raster that was added the first (it is lowest in the list)
rather than the one which is highlighted

I tried to fix this. Loading and unloading maps is a bit tricky and I'm afraid there are more such bugs.

this works now for various combinations and multiple surfaces as well

-nviz2/cmd does not compile, when I run make on it I get the following
/System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:503:
error: redefinition of ?struct Rect?
lipo: can't figure out the architecture type of:
/var/folders/-w/-wN910nTFamsDLR+fBkvB++++TI/-Tmp-//ccw2Iwjp.out
make: *** [OBJ.i386-apple-darwin10.7.0/vector.o] Error 1

nviz does not compile either ( I have some issue with my TclTk ), perhaps that
is causing problems with nviz_cmd?

.
Nviz_cmd is not connected with TclTk. Concerning the problem with compilation I'm afraid I cannot help. It might be connected with the changes in nviz_cmd vectors done by Martin recently and I'm sure he would now better how this could be solved.

OK, I will wait for this, it still complains about struct Rect

/System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:503: error: redefinition of ?struct Rect?
lipo: can't figure out the architecture type of: /var/folders/-w/-wN910nTFamsDLR+fBkvB++++TI/-Tmp-//cc4KN3CM.out
make: *** [OBJ.i386-apple-darwin10.7.0/vector.o] Error 1

Thank you, Helena

Best regards,
Anna

Hello,

Martin's fix allowed me to get wxNviz going and try it out. Your summer work has
make great improvements in getting this to the level of functionality of the old
tcltk nviz. The view controls work very well and the map updates automatically.
The data controls work well too and alter the image as indicated. The lighting
works really well too and I'm glad to see the cutting plane and fringe
functional. This is all very much appreciated. I have a few observations and
suggestions from going through and testing.

1. Position controls. Works fine. But this seems to make more sense on the view
page as it affects the orientation of the map display rather than the color or
character of the image itself (other things on the data page).

On data page there are things relating to one chosen map, so that's the reason why position is there.
But I agree it should be improved. I thought about some interactive positioning, I'm not sure how this could be done
but I'll try something.

2. Z-exag. Works fine. It would be nice if this could be a float with at least 1
decimal so that z-exag. of 1.5 or 2.5 could be set. Not a high priority though.

This shouldn't be problem.

3. Cutting plane. Most works fine. But the x and y sliders seem to do the same
thing. Height doesn't seem to have any affect. Tilt make visual cutting planes
disappear (same thing with TclTk).

x, y mean the rotation center, you can see it when you use rotation. Height
has effect only when using tilt. I know about the disappearing of the shading with tilt
but I'm not sure if I can do anything about it.

4. Fringe. All works well except the 'elevation from bottom' command. It doesn't
seem to do anything.

It works for me. Maybe it's another Mac problem.

Thanks for testing, it's welcomed.

Best regards
Anna

Anna,

I did some further testing. SVN from the past hour.

1) Volumes. These loaded OK. When I move them around in the view, I can see the bounding cube. But I can't see any isosurfaces or "slides" (slices?). Maybe I'm doing something wrong, but nothing appears no matter how I set it.

2) Fringe. I was able to get the height to update on my SRTM of the Jordan River valley, but cannot see any changes at all when I apply it to the Spearfish 10m DEM. Also, there are some places where the top does not match the topography. I'm attaching an image from the Spearfish elevation10m DEM to illustrate what I'm talking about. The top edge of the fringe follows the topography in some places, but cuts from a peak to a place in a valley (not the bottom) to the left of the peak. This may be an OpenGL issue, but should be looked into for this to be useful.

3) Graphic output (follow up on Hamish's post of earlier today). It works!! That is good. But it only seems to work for PPM. The Tif file that it creates will not open (tried in GIMP and Apple Preview). As Hamish notes, other formats would be welcome--jpeg and png especially.

4) Your point is well taken about adjusting one image versus adjusting all of them. But I'll make one more pitch for putting position onto the view page. It moves around images in the window to position them in different ways. This is what happens in the view window. Perhaps I'm unusual in this, but when I'm positioning the images (i.e., with the position tool), I also want to move them around with the view puck, adjust height, etc. When I'm changing image display properties (drape map, transparency, resolution, etc.), I'm less likely to be messing with positioning. But that's just me. How do others normally work with 3D images?

I'm not getting the terminal chatter that Markus reported. Maybe it's been fixed in the interim. The only thing I get is the following when I launch GRASS

Launching 'wxpython' GUI in the background, please wait...
GRASS 7.0.svn (Spearfish60_test):~ > Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0

...and the following when I quite the GUI after running wxNviz

pythonw2.6(3540,0xa070e540) malloc: *** error for object 0x21d0d980: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

Thanks again. This is really looking good. Haw hard is a north arrow?

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Jul 3, 2011, at 5:10 AM, Anna Kratochvílová wrote:

Hello,

Martin's fix allowed me to get wxNviz going and try it out. Your summer work has
make great improvements in getting this to the level of functionality of the old
tcltk nviz. The view controls work very well and the map updates automatically.
The data controls work well too and alter the image as indicated. The lighting
works really well too and I'm glad to see the cutting plane and fringe
functional. This is all very much appreciated. I have a few observations and
suggestions from going through and testing.

1. Position controls. Works fine. But this seems to make more sense on the view
page as it affects the orientation of the map display rather than the color or
character of the image itself (other things on the data page).

On data page there are things relating to one chosen map, so that's the reason why position is there.
But I agree it should be improved. I thought about some interactive positioning, I'm not sure how this could be done
but I'll try something.

2. Z-exag. Works fine. It would be nice if this could be a float with at least 1
decimal so that z-exag. of 1.5 or 2.5 could be set. Not a high priority though.

This shouldn't be problem.

3. Cutting plane. Most works fine. But the x and y sliders seem to do the same
thing. Height doesn't seem to have any affect. Tilt make visual cutting planes
disappear (same thing with TclTk).

x, y mean the rotation center, you can see it when you use rotation. Height
has effect only when using tilt. I know about the disappearing of the shading with tilt
but I'm not sure if I can do anything about it.

4. Fringe. All works well except the 'elevation from bottom' command. It doesn't
seem to do anything.

It works for me. Maybe it's another Mac problem.

Thanks for testing, it's welcomed.

Best regards
Anna

On Jul 4, 2011, at 3:39 PM, Michael Barton wrote:

Anna,

I did some further testing. SVN from the past hour.

1) Volumes. These loaded OK. When I move them around in the view, I can see the bounding cube. But I can't see any isosurfaces

Mike, make sure that you set the value of your isosurface, then add it and set polygon resolution to 1 - I have the isosurfaces loading at 3
and only very little shows up, but they pop-up at full resolution.
Also your isosurfaces may be under your surface (if you have any), you would have to change the surface position for now,
as the position is not implemented for volumes yet.
Finally, make sure you have the 3D region set up correctly - I find it rather tricky now when we have res3 for all
and you need to over ride it by tbres if you want different resolution vertically. 3D region setting may need some tune up.

or "slides" (slices?).

this might not have been implemented yet.

Maybe I'm doing something wrong, but nothing appears no matter how I set it.

2) Fringe. I was able to get the height to update on my SRTM of the Jordan River valley, but cannot see any changes at all when I apply it to the Spearfish 10m DEM. Also, there are some places where the top does not match the topography. I'm attaching an image from the Spearfish elevation10m DEM to illustrate what I'm talking about. The top edge of the fringe follows the topography in some places, but cuts from a peak to a place in a valley (not the bottom) to the left of the peak. This may be an OpenGL issue, but should be looked into for this to be useful.

the bad top edge of the fringe has been there from the very beginning - it may be computed based on coarse resolution -
it may be worth to check whether it is still a problem with a very small DEM when everything is loaded at resolution 1.
But it may be something entirely different and goes beyond wxnviz. Of course it would be great to find a fix.

3) Graphic output (follow up on Hamish's post of earlier today). It works!! That is good. But it only seems to work for PPM. The Tif file that it creates will not open (tried in GIMP and Apple Preview).

I can open the saved tif with Preview

As Hamish notes, other formats would be welcome--jpeg and png especially.

yes, especially for MSWindows users without tiff support.

4) Your point is well taken about adjusting one image versus adjusting all of them. But I'll make one more pitch for putting position onto the view page. It moves around images in the window to position them in different ways. This is what happens in the view window. Perhaps I'm unusual in this, but when I'm positioning the images (i.e., with the position tool), I also want to move them around with the view puck, adjust height, etc. When I'm changing image display properties (drape map, transparency, resolution, etc.), I'm less likely to be messing with positioning. But that's just me. How do others normally work with 3D images?

I haven't looked into this. I will try it next.

I'm not getting the terminal chatter that Markus reported. Maybe it's been fixed in the interim. The only thing I get is the following when I launch GRASS

Launching 'wxpython' GUI in the background, please wait...
GRASS 7.0.svn (Spearfish60_test):~ > Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0

...and the following when I quite the GUI after running wxNviz

pythonw2.6(3540,0xa070e540) malloc: *** error for object 0x21d0d980: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

that is what I am getting too but it is not causing any problems.

Helena

Thanks again. This is really looking good. Haw hard is a north arrow?

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Jul 3, 2011, at 5:10 AM, Anna Kratochvílová wrote:

Hello,

Martin's fix allowed me to get wxNviz going and try it out. Your summer work has
make great improvements in getting this to the level of functionality of the old
tcltk nviz. The view controls work very well and the map updates automatically.
The data controls work well too and alter the image as indicated. The lighting
works really well too and I'm glad to see the cutting plane and fringe
functional. This is all very much appreciated. I have a few observations and
suggestions from going through and testing.

1. Position controls. Works fine. But this seems to make more sense on the view
page as it affects the orientation of the map display rather than the color or
character of the image itself (other things on the data page).

On data page there are things relating to one chosen map, so that's the reason why position is there.
But I agree it should be improved. I thought about some interactive positioning, I'm not sure how this could be done
but I'll try something.

2. Z-exag. Works fine. It would be nice if this could be a float with at least 1
decimal so that z-exag. of 1.5 or 2.5 could be set. Not a high priority though.

This shouldn't be problem.

3. Cutting plane. Most works fine. But the x and y sliders seem to do the same
thing. Height doesn't seem to have any affect. Tilt make visual cutting planes
disappear (same thing with TclTk).

x, y mean the rotation center, you can see it when you use rotation. Height
has effect only when using tilt. I know about the disappearing of the shading with tilt
but I'm not sure if I can do anything about it.

4. Fringe. All works well except the 'elevation from bottom' command. It doesn't
seem to do anything.

It works for me. Maybe it's another Mac problem.

Thanks for testing, it's welcomed.

Best regards
Anna

Helena,

On Jul 4, 2011, at 4:20 PM, Helena Mitasova wrote:

On Jul 4, 2011, at 3:39 PM, Michael Barton wrote:

Anna,

I did some further testing. SVN from the past hour.

1) Volumes. These loaded OK. When I move them around in the view, I can see the bounding cube. But I can't see any isosurfaces

Mike, make sure that you set the value of your isosurface, then add it and set polygon resolution to 1 - I have the isosurfaces loading at 3
and only very little shows up, but they pop-up at full resolution.
Also your isosurfaces may be under your surface (if you have any), you would have to change the surface position for now,
as the position is not implemented for volumes yet.
Finally, make sure you have the 3D region set up correctly - I find it rather tricky now when we have res3 for all
and you need to over ride it by tbres if you want different resolution vertically. 3D region setting may need some tune up.

Well, for this reason, I was testing in a mapset where I'd done 3D work previously and had it displayed with the old NVIZ. But I'll look more closely at all the settings to make sure that it's OK.

or "slides" (slices?).

this might not have been implemented yet.

Maybe I'm doing something wrong, but nothing appears no matter how I set it.

2) Fringe. I was able to get the height to update on my SRTM of the Jordan River valley, but cannot see any changes at all when I apply it to the Spearfish 10m DEM. Also, there are some places where the top does not match the topography. I'm attaching an image from the Spearfish elevation10m DEM to illustrate what I'm talking about. The top edge of the fringe follows the topography in some places, but cuts from a peak to a place in a valley (not the bottom) to the left of the peak. This may be an OpenGL issue, but should be looked into for this to be useful.

the bad top edge of the fringe has been there from the very beginning - it may be computed based on coarse resolution -
it may be worth to check whether it is still a problem with a very small DEM when everything is loaded at resolution 1.
But it may be something entirely different and goes beyond wxnviz. Of course it would be great to find a fix.

3) Graphic output (follow up on Hamish's post of earlier today). It works!! That is good. But it only seems to work for PPM. The Tif file that it creates will not open (tried in GIMP and Apple Preview).

I can open the saved tif with Preview

It gave me an error. I remember this happening before. It turns out that the "tif" file is really a ppm. If I change the extension to *.ppm it open fine in GIMP and Graphic Convertor.

As Hamish notes, other formats would be welcome--jpeg and png especially.

yes, especially for MSWindows users without tiff support.

4) Your point is well taken about adjusting one image versus adjusting all of them. But I'll make one more pitch for putting position onto the view page. It moves around images in the window to position them in different ways. This is what happens in the view window. Perhaps I'm unusual in this, but when I'm positioning the images (i.e., with the position tool), I also want to move them around with the view puck, adjust height, etc. When I'm changing image display properties (drape map, transparency, resolution, etc.), I'm less likely to be messing with positioning. But that's just me. How do others normally work with 3D images?

I haven't looked into this. I will try it next.

I'm not getting the terminal chatter that Markus reported. Maybe it's been fixed in the interim. The only thing I get is the following when I launch GRASS

Launching 'wxpython' GUI in the background, please wait...
GRASS 7.0.svn (Spearfish60_test):~ > Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0
Mon Jul 4 12:14:16 cmb-MBP-3.local pythonw2.6[3540] <Error>: CGContextRestoreGState: invalid context 0x0

...and the following when I quite the GUI after running wxNviz

pythonw2.6(3540,0xa070e540) malloc: *** error for object 0x21d0d980: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

that is what I am getting too but it is not causing any problems.

Right.

Michael

Helena

Thanks again. This is really looking good. Haw hard is a north arrow?

Michael
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

On Jul 3, 2011, at 5:10 AM, Anna Kratochvílová wrote:

Hello,

Martin's fix allowed me to get wxNviz going and try it out. Your summer work has
make great improvements in getting this to the level of functionality of the old
tcltk nviz. The view controls work very well and the map updates automatically.
The data controls work well too and alter the image as indicated. The lighting
works really well too and I'm glad to see the cutting plane and fringe
functional. This is all very much appreciated. I have a few observations and
suggestions from going through and testing.

1. Position controls. Works fine. But this seems to make more sense on the view
page as it affects the orientation of the map display rather than the color or
character of the image itself (other things on the data page).

On data page there are things relating to one chosen map, so that's the reason why position is there.
But I agree it should be improved. I thought about some interactive positioning, I'm not sure how this could be done
but I'll try something.

2. Z-exag. Works fine. It would be nice if this could be a float with at least 1
decimal so that z-exag. of 1.5 or 2.5 could be set. Not a high priority though.

This shouldn't be problem.

3. Cutting plane. Most works fine. But the x and y sliders seem to do the same
thing. Height doesn't seem to have any affect. Tilt make visual cutting planes
disappear (same thing with TclTk).

x, y mean the rotation center, you can see it when you use rotation. Height
has effect only when using tilt. I know about the disappearing of the shading with tilt
but I'm not sure if I can do anything about it.

4. Fringe. All works well except the 'elevation from bottom' command. It doesn't
seem to do anything.

It works for me. Maybe it's another Mac problem.

Thanks for testing, it's welcomed.

Best regards
Anna