<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi,<br><br>I have an 3d visualization application which reads data from a file which isn't related to vtk and at present I'm having to write the data out in vtk format to disk and then let a vtk reader read it a second time.&nbsp; <br><br>It would help considerably if I was able to simply pass the data to vtk internally but thus far I've not been able to figure out how to do it and nothing I see on the web helps.&nbsp; The data is unsigned char and the piece of code which presents it looks like this:<br><br><div style="margin-left: 80px;"><font size="1">&nbsp;<span style="color: rgb(0, 128, 255);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void AddBagVolumeToWindow4(vtk.vtkRenderWindow renWin)</span></font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);"
 size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 3d texture map</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkStructuredPointsReader reader = new vtkStructuredPointsReader();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolume volume = new vtkVolume();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolumeProperty volumeProperty = new vtkVolumeProperty();</font><br style="color: rgb(0, 128, 255);"><br style="color:
 rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderer renderer = new vtkRenderer();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor interactor = new vtkRenderWindowInteractor();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkVolumeTextureMapper3D volumeMapper = new vtkVolumeTextureMapper3D();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //vtkVolumeRayCastCompositeFunction compositeFunction = new vtkVolumeRayCastCompositeFunction();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128,
 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction opacity = new vtkPiecewiseFunction();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkColorTransferFunction color = new vtkColorTransferFunction();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.SetFileName("c:\\zz.vtk");</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader.Update();</font><br style="color: rgb(0, 128,
 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opacity.AddPoint(0, 0);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opacity.AddPoint(64, .005);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opacity.AddPoint(128, .01);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opacity.AddPoint(200, .05);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; opacity.AddPoint(220, .4);</font><br style="color: rgb(0, 128,
 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; color.AddRGBPoint(64, .665, .84, .88);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; color.AddRGBPoint(128, 0, .746, .95);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; color.AddRGBPoint(220, 0, 1, 0);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; color.AddRGBPoint(230, 1, 0, 0);</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);"
 size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeProperty.SetColor(color);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeProperty.SetScalarOpacity(opacity);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeProperty.SetInterpolationTypeToLinear();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeProperty.ShadeOn();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volumeMapper.SetInput(reader.GetOutput());</font><br style="color: rgb(0,
 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //int[] iiex = reader.GetOutput().GetExtent();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volume.SetMapper(volumeMapper);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volume.SetProperty(volumeProperty);</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renderer.SetBackground(1, 1, 1);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);"
 size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renderer.AddVolume(volume);</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interactor.SetRenderWindow(renWin);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renWin.AddRenderer(renderer);</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renx = renderer;</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; volx = volume;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 </font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; renWin.Render();</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interactor.Start();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtk.vtkWin32OpenGLRenderWindow win32win =</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtk.vtkWin32OpenGLRenderWindow.SafeDownCast(renWin);</font><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);"
 size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; win32win.Clean();</font><br style="color: rgb(0, 128, 255);"><br style="color: rgb(0, 128, 255);"><font style="color: rgb(0, 128, 255);" size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</font><br style="color: rgb(0, 128, 255);"></div><font size="3"><br style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 0);">That's after the data has been written out to </span></font><font style="color: rgb(0, 0, 0);" size="3">"c:\\zz.vtk</font>" of course.&nbsp; What it looks like I'd want to do, rather <font size="3">than use the </font><font style="color: rgb(0, 0, 0);" size="3">vtkStructuredPointsReader, is to set up my own vtkStructuredPoints object something like:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font style="color: rgb(0, 0, 0);" size="3">vtkStructuredPoints </font><font style="color: rgb(0, 0, 0);" size="3">bsp = new
 vtkStructuredPoints();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bsp.SetScalarTypeToUnsignedChar();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bsp.SetDimensions(Width, Height, NumSlices);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bsp.SetOrigin(0, 0, 0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bsp.SetExtent(0, Width - 1, 0, Height - 1, 0, NumSlices - 1);<br><br>&nbsp;</font>and then set the data array but, again, I've no clue as to how to do that.&nbsp; Any help would be apreciated.<br><br><br>Ted<br><br><br><br><br></div></div><br>

      </body></html>