[vtkusers] Problem getting correct results with vtkProjectedTerrainPath

Elvis Dowson elvis.dowson at mac.com
Fri Nov 14 10:54:31 EST 2008


Hi,
         I've been trying to debug why nothing gets displayed when  
using the vtkProbeFilter and sampling the results to vtkImageData.

I've discovered now that when the probe filter is introduced into the  
pipeline, it is somehow altering the data type from unsigned char, to  
something else.

Question 01: How can I force the output of vtkProbeFilter to store the  
results in unsigned char?

Question 02: How can I find out the type used to store the results in  
vtkImageData, after it has passed through the vtkProbeFilter?


Here are my current findings

# Use a probe filter to obtain elevation data from the reconstructed  
surface
vtkImageData elevationData
   elevationData SetScalarTypeToUnsignedChar
   elevationData SetWholeExtent $XminR $XmaxR $YminR $YmaxR $ZminR  
$ZmaxR
   elevationData SetDimensions $XmaxD $YmaxD $ZmaxD
   elevationData SetOrigin $XminB $YminB $ZminB
   elevationData SetSpacing $width $height $length
   elevationData AllocateScalars

# Fill image with zeroes
set d 100
for {set i 0} {$i <  $XmaxD} {incr i} {
   for {set p 0} {$p <  $YmaxD} {incr p} {
   elevationData SetScalarComponentFromFloat $i $p 0 0 $d
   }
}

vtkImageActor imageActor
   imageActor SetInput elevationData

When you don't use the probe filter, I get the following output (I'm  
only displaying the image data and simply displaying it on screen)



How ever, the moment I introduce the probe filter, I get the following  
error


ERROR: In /Users/elvis/Tool/vtk-5.x/src/VTK/Rendering/ 
vtkImageActor.cxx, line 267
vtkOpenGLImageActor (0x8a0200): This filter requires unsigned char  
scalars as input

Here is the code with the probe filter

# Use a probe filter to obtain elevation data from the reconstructed  
surface
vtkImageData elevationData
   elevationData SetScalarTypeToUnsignedChar
   elevationData SetWholeExtent $XminR $XmaxR $YminR $YmaxR $ZminR  
$ZmaxR
   elevationData SetDimensions $XmaxD $YmaxD $ZmaxD
   elevationData SetOrigin $XminB $YminB $ZminB
   elevationData SetSpacing $width $height $length
   elevationData AllocateScalars


# Fill image with zeroes
set d 100
for {set i 0} {$i <  $XmaxD} {incr i} {
   for {set p 0} {$p <  $YmaxD} {incr p} {
   elevationData SetScalarComponentFromFloat $i $p 0 0 $d
   }
}

vtkProbeFilter probe
   probe SetInputConnection 0 [elevationData GetProducerPort]
   probe SetInputConnection 1 [reader GetOutputPort]
   probe Update

vtkImageActor imageActor
   imageActor SetInput elevationData


This shows that vtkProbeFilter is storing the results in a format  
other than unsigned char.

How can I fix this and get it to store the probed results in unsigned  
char?

Best regards,

Elvis


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081114/be6e669a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Problem with vtkProjectedTerrainPath 05.jpg
Type: image/jpeg
Size: 22742 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081114/be6e669a/attachment.jpg>


More information about the vtkusers mailing list