<x-html>
<html>
Try: imapper->SetColorWindow(255);
imapper->SetColorLevel(127.5);<br>
<br>
These values should probably be the default.<br>
<br>
Charles. <br>
<br>
<br>
At 07:22 PM 12/1/99 -0500, K.R.Subramanian wrote:<br>
<blockquote type=cite cite> <br>
I am trying a simple example of using the imaging pipeline(never used it
before); it should display a <br>
white image as follows; I am wondering <br>
if the way I am creating the image (using vtkScalars) is the right way to
do it. I only get a solid black image. <br>
I am using a 3 component scalar array as part of the vtkImageData. <br>
<br>
Thanks. <br>
<br>
-- krs <br>
<br>
<br>
void main() <br>
{ <br>
// Create Image data <br>
<br>
vtkImageData *image = vtkImageData::New(); <br>
image->SetDimensions (256,256,1); <br>
<br>
vtkScalars *scalars = vtkScalars::New(VTK_UNSIGNED_CHAR, 3);
<br>
scalars->SetNumberOfComponents (3); <br>
scalars->SetNumberOfScalars (256*256); <br>
<br>
int n = 0; <br>
for (int i = 0; i < 256; i++) <br>
for (int j = 0; j < 256; j++) <br>
{ <br>
scalars->SetActiveComponent
(0); scalars->SetScalar(n, 255); <br>
scalars->SetActiveComponent
(1); scalars->SetScalar(n, 255); <br>
scalars->SetActiveComponent
(2); scalars->SetScalar(n, 255); <br>
n++; <br>
} <br>
<br>
image->GetPointData()->SetScalars (scalars); <br>
<br>
<br>
// create mapper, imager and image window <br>
<br>
vtkImageMapper *imapper = vtkImageMapper::New(); <br>
imapper->SetInput (image); <br>
imapper->SetZSlice (0); <br>
vtkActor2D *image_actor = vtkActor2D::New(); <br>
image_actor->SetMapper (imapper); <br>
<br>
<br>
vtkImager *ren1 = vtkImager::New(); <br>
ren1->AddActor2D (image_actor); <br>
ren1->SetViewport (0.0, 1.0, 0.0, 1.0); <br>
<br>
vtkImageWindow *renWin = vtkImageWindow::New(); <br>
renWin->SetSize( 256, 256 ); <br>
renWin->AddImager(ren1); <br>
<br>
renWin->Render(); <br>
<br>
sleep (5); <br>
} <br>
<br>
<br>
<pre>--
K.R.Subramanian
Phone: (704) 547-4872
Department of Computer
Science
FAX: (704) 547-3516
UNC
Charlotte
Email: krs@cs.uncc.edu
9201 Univ. City
Blvd.
WWW:
<a href="http://www.cs.uncc.edu/~krs">http://www.cs.uncc.edu/~krs</a>
Charlotte, NC 28223-0001</pre>
</blockquote></html>
-----------------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo@gsao.med.ge.com>. For help, send message body containing
"info vtkusers" to the same address. Live long and prosper.
-----------------------------------------------------------------------------
</x-html>