[GRASS-dev] wxNviz volumes

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

Helena wrote:

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.

Hi,

slightly off-topic, but something I've been wondering about-

do you have any good strategies for semi-automatically choosing
isosurface levels? or do you just pick them by eye?

perhaps 9 slices by histogram of values?
r3.univar precentile=`seq -s"," 5 10 95`
?

or is a linear split like for standard 2D contour lines less
confusing for the viewer to understand?

(I'm working with heavily vertically stratified data and the
linear approach isn't working very well)

thanks,
Hamish

Hello Helena,

>> - 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?

3D raster must be loaded from the layer manager toolbar first like any other maps do.
In wxnviz only loaded maps (in Map layers tab) are offered. You tried this and it still doesn't work?
Maybe I'm missing something.

I was able to find just the Slovakia3D dataset. Could you tell me where I can find any other volumes
for better testing?

I would like to ask if the new feature - generating commands for nviz_cmd is ok or if the interface should look
differently (where the output should be written etc.). So if you have some ideas please tell me.

Anna

On Jul 2, 2011, at 7:35 AM, Anna Kratochvílová wrote:

Hello Helena,

- 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?

3D raster must be loaded from the layer manager toolbar first like any other maps do.
In wxnviz only loaded maps (in Map layers tab) are offered. You tried this and it still doesn't work?
Maybe I'm missing something.

I finally remembered the button where to add it - it is working now:

There are still a few issues

- levels for isosurfaces need to be floating point - now, if I set it to 0.5 I get 0
- redraw is not working automatically - I need to change view to get redraw
(similar to what we had for 2D raster surfaces)
- I think the emission parameter can be removed

When working with two volumes (I will include several volumes in the test data set
for you to try this out):

- when second volume is added the list of isosurfaces needs to be cleared,
it becomes all mixed up - I can get several levels with the same value and
it is not clear to which volume which applies

- isosurfaces for second volume stay black even after I changed color to constant red
(it looks like they don't get any light)

- after switching off the second volume in map layers it disapears but when I switch it back on
and define isosurface for it, the isosurfaces do not come back.

- volumes need position control similar to the surfaces - e.g. I have isosurfaces from two volumes
and I need to view them both overlayed and separated (e.g. above each other -
to see the spatial relationship

I was able to find just the Slovakia3D dataset. Could you tell me where I can find any other volumes
for better testing?

I will post a mapset with some data in a day or two, I just need to clean it up.

I would like to ask if the new feature - generating commands for nviz_cmd is ok or if the interface should look
differently (where the output should be written etc.). So if you have some ideas please tell me.

when I click on the Generate command for nviz_cmd nothing happens, here is the traceback:

Traceback (most recent call last):
  File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/toolbars.py", line
1353, in OnNvizCmd

self.lmgr.GetLogWindow().WriteLog(text = cmd, switchPage =
True)
  File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/goutput.py", line
385, in WriteLog

self.cmd_output.SetStyle()
  File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/goutput.py", line
1019, in SetStyle

settings = preferences.Settings()
  File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/preferences.py",
line 64, in __init__

self.filePath = os.path.join(utils.GetSettingsPath(), 'wx')
  File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/utils.py", line
759, in GetSettingsPath

version = int(grass.version()['version'].split('.', 1)[0])
KeyError
:
'version'

Helena

Anna

On Jul 2, 2011, at 7:35 AM, Anna Kratochvílová wrote:

Hello Helena,

- 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?

3D raster must be loaded from the layer manager toolbar first like any other maps do.
In wxnviz only loaded maps (in Map layers tab) are offered. You tried this and it still doesn't work?
Maybe I'm missing something.

I was able to find just the Slovakia3D dataset. Could you tell me where I can find any other volumes
for better testing?

I am working on a new one but I got into some troubles when I tried to extend the data set and use mask.

Meanwhile you can try this:
get this raster time series mapset and put it into nc_spm_08
http://courses.ncsu.edu/mea582/common/media/01/NagsHead_series.zip
then generate a space-time cube representation of the time series for a small subregion:

g.region n=250416 s=249942 w=913734 e=914022 t=40 b=12 nsres=2 ewres=2 res3=2 tbres=4 -ap3
r.to.rast3 in=NH_1999_1m,NH_2001_1m,NH_2004_1m,NH_2005_1m,NH_2007_1m,NH_2008_1m out=NH_99_08_stack
#check your values
r3.info NH_99_08_stack

you can then use elevation raster NH_2008_1m in combination with with NH_99_08_stack
to test everything for a single volume (isosurfaces 6, 10, 12 work well)

to generate second volume for testing over little bit larger area (I had to quit grass when changing
computational region because the 3d view was stuck with the previous region and I could not find a way
to get it to update to the new region)

g.region rast=NH_1999_1m t=40 b=12 tbres=4 -p3
r.to.rast3 in=NH_1999_1m,NH_2001_1m,NH_2004_1m,NH_2005_1m,NH_2007_1m,NH_2008_1m out=NH_99_08_largestack
r3.info NH_99_08_largestack

you can then use NH_2008_1m in combination with with NH_99_08_stack and NH_99_08_largestack
to test handling of two volumes. You will note that whichever volume you you have loaded a second one,
it will draw the isosurfaces in black - I think they are not illuminated.

Let me know if something is not clear, it is still a little bit tricky but it works,

I would like to ask if the new feature - generating commands for nviz_cmd is ok or if the interface should look
differently (where the output should be written etc.). So if you have some ideas please tell me.

it is good as is right now, I think users can write scripts on their own to run the command through series
of raster maps to generate the dynamic surfaces. Of course, GUI would be helpful but I would leave it after
wxnviz core functionality runs well.
One issue came to mind when looking at the command (I think this was already discussed before) - would it be possible
to replace the ppm output with png or other more common format?

Helena

Anna

Helena wrote:

One issue came to mind when looking at the command (I think
this was already discussed before) - would it be possible
to replace the ppm output with png or other more common
format?

in the tcl/tk version of NVIZ it is done that way due to the
lack of support for other formats, unless we add external
dependencies and system() calls which are not very portable.
(maybe just PPM & GIF are allowed directly from tcl/tk?)

the Wx version shouldn't be limited by that.

rough memory,
Hamish

On Jul 1, 2011, at 11:59 PM, Hamish wrote:

Helena wrote:

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.

Hi,

slightly off-topic, but something I've been wondering about-

do you have any good strategies for semi-automatically choosing
isosurface levels? or do you just pick them by eye?

for isosurfaces and volume in general you really need to display them interactively
so that you can see them from all sides and switch isosurfaces on and off
basedon which level you are interested in and slice thruogh the volume.

For presentations, we have been using animations like these
browsing through isosurface levels:
http://skagit.meas.ncsu.edu/~helena/measwork/nc_coast/NHiso.gif
http://skagit.meas.ncsu.edu/~helena/measwork/nc_coast/oi_iso.gif
http://skagit.meas.ncsu.edu/~helena/measwork/nc_coast/oi_isoS.gif
(I use gifs here because they are so easy to generate, but movie formats
such as quicktime or mpg that have viewer that allows you to browse through
the frames and stop where you want to show something interesting is better),
decorations such as legend with pointer will also help

If movie is not an option, for one of our publications,
I included a set of images - each isosurface value in a separate image:
http://skagit.meas.ncsu.edu/~helena/publwork/jcrbhi/JCRfig6_isosurfacesF.tif

These are some older volume movies by Bill Brown
(they play little too fast on todays machines but you can browse through them)
http://skagit.meas.ncsu.edu/~helena/gmslab/gsoils/movie/phb.mpg
http://skagit.meas.ncsu.edu/~helena/gmslab/gsoils/movie/codbox.mpg
http://skagit.meas.ncsu.edu/~helena/gmslab/gsoils/movie/phslice2.mpg
they are explained here (still a draft document, after more than 12 years)
http://skagit.meas.ncsu.edu/~helena/gmslab/gsoils/ccsoil2.html

Depending on your data generating the isosurfaces using -e or ln may help,
at least for static figures.

Browsing through the volumes should be much easier with wxnviz that saves settings
into nviz_cmd command, so one can just loop the the isosurface values
or crossection coordinates to generate the frames for the movie.

Helena

perhaps 9 slices by histogram of values?
r3.univar precentile=`seq -s"," 5 10 95`
?

or is a linear split like for standard 2D contour lines less
confusing for the viewer to understand?

(I'm working with heavily vertically stratified data and the
linear approach isn't working very well)

thanks,
Hamish

Hi,

2011/7/2 Helena Mitasova <hmitaso@ncsu.edu>:

Traceback (most recent call last):
File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/toolbars.py", line
1353, in OnNvizCmd

self.lmgr.GetLogWindow().WriteLog(text = cmd, switchPage =
True)
File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/goutput.py", line
385, in WriteLog

self.cmd_output.SetStyle()
File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/goutput.py", line
1019, in SetStyle

settings = preferences.Settings()
File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/preferences.py",
line 64, in __init__

self.filePath = os.path.join(utils.GetSettingsPath(), 'wx')
File "/Users/helena/grassdev7/grass_trunk/dist.i386-apple-
darwin10.7.0/etc/gui/wxpython/gui_modules/utils.py", line
759, in GetSettingsPath

version = int(grass.version()['version'].split('.', 1)[0])
KeyError
:
'version'

it's not related, hopefully fixed in r46949.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Hello,

There are still a few issues

- levels for isosurfaces need to be floating point - now, if I set it to 0.5 I
get 0

I changed spinctrl to floatspin, it's not available in older versions of wx (not sure about Mac),
so try it. If floatspin is not available, spinctrl is used

- redraw is not working automatically - I need to change view to get redraw
(similar to what we had for 2D raster surfaces)

It works for me. When exactly does this happen? It sometimes takes a few seconds
to draw the isosurfaces.

- I think the emission parameter can be removed

Done.

When working with two volumes (I will include several volumes in the test data
set
for you to try this out):

- when second volume is added the list of isosurfaces needs to be cleared,
it becomes all mixed up - I can get several levels with the same value and
it is not clear to which volume which applies

It should work now.

- isosurfaces for second volume stay black even after I changed color to
constant red
(it looks like they don't get any light)

I cannot confirm it. Although one side of isosurface is quite dark, the other is
illuminated. I added the "toggle normal direction" feature, try if this helps.

- after switching off the second volume in map layers it disapears but when I
switch it back on
and define isosurface for it, the isosurfaces do not come back.

Hopefully fixed.

- volumes need position control similar to the surfaces - e.g. I have
isosurfaces from two volumes
and I need to view them both overlayed and separated (e.g. above each other -
to see the spatial relationship

I added this functionality. It is the same as for surfaces.

I will try volumes on Vasek's computer which had some similar problems
as yours (although it's not Mac), so maybe I will find out the problems you mentioned.

Anna