[vtkusers] Help, please. vtkStreamingDemandDrivenPipeline Update extent error
Marty Humperdink
mhumperdink at yahoo.com
Tue Feb 17 11:57:11 EST 2009
Kevin,
Thanks for your reply. I've run the programs through the command line and just by clicking the icon and get the same error in each case.
The vtkOutputWindow turns white and I can't read the entire error message but it start with the vtkStreamingDemandDrivenPipeline error mentioned below.
As I mentioned I'm working on two separate projects. In one I'm trying to simulate CT scan resolution artifacts in an stl model. To do this I load the STL model,
create an empty vtkImageData with spacing set to typical CT values (0.59x0.59x1.25), use vtkPolyDataToImage stencil to turn the stl polydata into a stencil, then
use vtkStencil to change the voxels in the empty imageData that was created. Then I could use a contour filter to go back to "chunkier" looking polyData. In this project I found that I was having trouble placing the empty imageData so that it encompassed the extent of the stl polyData. The stls that I'm using have bounds that go from about -50 to +50 in each dimension and I found that if I tried to set the imageData so that it would cover this coordinate range I go this vtkStreamingDemandDrivenPipeline. Eventually I translated the polydata so its minimum bound was zero in each dimension and set the imageData extent to go from 0 to the max bound. This works okay but introduced a whole bunch of other headaches by moving the original polydata around.
So one question here is how can I create a blank image data that covers the coordinate range of say x: -50 to +50, y: -50 to +50, and z: -50 to +50? I think I might be misunderstanding the difference between SetExtents and SetDimensions in vtkImageData...
In the second project I'm trying to convert some 3D ultrasound data, which apparently is in spherical coordinates, to Cartesian coords and then save out the volume. The original image data is in a raw format and I'm manually entering the geometric parameters into a little GUI. I figured I would load the raw data using vtkImageReader2, create a vtkPoints array first calculating spherical coordinates from the known image parameters then converting these to Cartesian coordinates and placing in the points array, loop through and fetch the pixel values from the image data, then assign both these points and scalars to the structured grid. Then I wanted to make an empty imageData that would encompass the entire structured grid and use this imageData to probe the structured grid thereby resampling the Spherical coordinate data into a regular image grid. I've been getting this vtkStreamingDemandDrivenPipeline over and over at the point that the vtkProbe Updates.
If I use vtkPolyData instead of a vtkStructuredGrid for the data in Spherical coordinates it runs without error, but takes a long time and doesn't seem like the right way to do this.
There's an excerpt of the Tcl script below. I'm using nested loops here and am assuming that there is probably a better way to do it, but right now am justing working on getting a prototype going. I guess another question I ought to ask is can someone point me in the direction of an example routine to load and resample 3D ultrasound data (in Spherical coordinates)?
I search the mailing list archives for some time and saw some reference to this vtkStreamingDemandDrivenPipeline error in other messages. Most responses suggested calling an Update at some point in the pipeline and I've added and removed Updates at nearly every step. There was also some suggestion to call an UpdateExtent with -1 1 -1 1 -1 1 on an Actor in order to force an update. I tried this kind of thing without apparent success. In this project I'm also trying to create a blank imageData that covers the coordinate range of another object, this time the structuredGrid. What's the best way to do this? I've tried using GetBounds and applying these results to SetExtent or SetDimensions in the imageData but it doesn't seem to work.
Sorry for the long series of questions, but I'm pretty stuck here and getting way behind. As a novice VTK user I realize that many of my mistakes are pretty elementary but I would be tremendously appreciative if someone could please help me with some suggestions.
Thanks
Marty
# Load Image Data
vtkImageReader2 imageData
imageData SetFileName $imageFilenameFull
imageData SetFileDimensionality 3
imageData SetDataSpacing $NFOxVoxelSize $NFOyVoxelSize $NFOzVoxelSize
imageData SetDataExtent 0 [expr $NFOwidth -1] 0 [expr $NFOheight -1] 0 [expr $NFOnumFrames -1]
#create structured grid with dimensions from raw image
vtkStructuredGrid imageStructuredGrid
imageStructuredGrid SetDimensions $NFOwidth $NFOheight $NFOnumFrames
#create points for sgrid
vtkPoints structGridPoints
#create array for pixel values
vtkDoubleArray pixelValues
#start a counter
set counter 0
# nested loops to get pixel values from raw image data then assign to Structured Grid
# with points in Spherical coords.
for {set iFrame 0 } {$iFrame <= [expr $NFOnumFrames - 1]} {incr iFrame 1} {
for {set jHeight 0} {$jHeight <= [expr $NFOheight -1]} {incr jHeight 1} {
for {set kWidth 0} {$kWidth <= [expr $NFOwidth - 1]} {incr kWidth 1} {
#fetch pixel value from imageData
set pixValue [[[[imageData GetOutput] GetPointData] GetScalars ] GetComponent [[imageData GetOutput] FindPoint $kWidth $jHeight $iFrame] 0 ]
pixelValues InsertTuple1 $counter $pixValue
#get corresponding point
set pointValue [[imageData GetOutput] GetPoint [[imageData GetOutput] FindPoint $kWidth $jHeight $iFrame]]
#calc spherical coords from user entered parameters
set sphereCoordsR [expr ([lindex $pointValue 0] * $pixStep) + $startDist]
set sphereCoordsTheta [expr ([lindex $pointValue 1] * $thetaStep) + $thetaStartAngle]
set sphereCoordsPhi [expr ([lindex $pointValue 2] * $phiStep) + $phiStartAngle]
#use separate procedure to calc Cart coords from Spherical coords
set cartCoords [sphere2Cart $sphereCoordsR $sphereCoordsTheta $sphereCoordsPhi]
structGridPoints InsertPoint $counter [lindex $cartCoords 0] [lindex $cartCoords 1] [lindex $cartCoords 2]
#increment counter
set counter [expr $counter + 1]
}
}
}
#drop the original image data
imageData Delete
#find bounds of structured grid points
set structGridBounds [structGridPoints GetBounds]
set x0 [lindex $structGridBounds 0]
set x1 [lindex $structGridBounds 1]
set y0 [lindex $structGridBounds 2]
set y1 [lindex $structGridBounds 3]
set z0 [lindex $structGridBounds 4]
set z1 [lindex $structGridBounds 5]
#set points and scalars in structured grid
imageStructuredGrid SetPoints structGridPoints
[imageStructuredGrid GetPointData] SetScalars pixelValues
set outPixSize 1.0
set outSliceThick 1.0
#create an imageData object for the probe
vtkImageData cartImageProbe
cartImageProbe SetDimensions [expr int(ceil(($x1 - $x0) / $outPixSize))] [expr int(ceil(($y1 - $y0) / $outPixSize))] [expr int(ceil(($z1 - $z0) / $outSliceThick))]
cartImageProbe SetSpacing $outPixSize $outPixSize $outSliceThick
cartImageProbe SetOrigin $x0 $y0 $z0
#probe the structured grid with the imageData
vtkProbeFilter probe
probe SetInput cartImageProbe
probe SetSource imageStructuredGrid
________________________________
From: Kevin H. Hobbs <hobbsk at ohiou.edu>
To: Marty Humperdink <mhumperdink at yahoo.com>
Cc: vtkusers at vtk.org
Sent: Monday, February 16, 2009 8:46:58 AM
Subject: Re: [vtkusers] Help, please. vtkStreamingDemandDrivenPipeline Update extent error
Marty Humperdink wrote:
>
> In both projects I'm stuck getting an error that looks like this:
> vtkStreamingDemandDrivenPipeline (061A8E28): The update extent specified in the information for output port 0 on algorithm ....
> Unfortunately the error disappears from the vtkOutput window when Windows tosses up one of those 'VTK.exe had to close do you want to send a report' messages so
Are you running the program from the command line, or just clicking on the icon?
Are you able to share the tcl code to the program you are writing?
More information about the vtkusers
mailing list