<DIV id=RTEContent>hello,</DIV> <DIV>Does anyone know how to create an image from scratch in memory in VTK.</DIV> <DIV>I tried this and many other things but it doesnt work.....</DIV> <DIV> </DIV> <DIV>**************************************************************************************************</DIV> <DIV>vtkImageData *pZImage = vtkImageData::New();</DIV> <DIV>pZImage->SetDimensions( wx , wy , 1 );</DIV> <DIV>pZImage->SetOrigin( 0 , 0 , 0 );</DIV> <DIV>pZImage->SetSpacing( 1 , 1 , 1 );</DIV> <DIV>pZImage->SetScalarTypeToUnsignedChar();</DIV> <DIV>pZImage->SetNumberOfScalarComponents( 1 );</DIV> <DIV>pZImage->AllocateScalars();</DIV> <DIV> </DIV> <DIV>vtkUnsignedCharArray *pScalars = (vtkUnsignedCharArray *) pZImage->GetPointData()->GetScalars();</DIV> <DIV> </DIV> <DIV><BR>for( int i = 0 ; i < wx ; i++ )</DIV> <DIV>{</DIV> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV>for( int j = 0 ; j < wy ; j++ )</DIV>
<DIV>{</DIV> <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"> <DIV>int index = i * j;</DIV> <DIV> </DIV> <DIV>pScalars->SetValue( index , 0 ); </DIV></BLOCKQUOTE> <DIV>} </DIV></BLOCKQUOTE> <DIV>}</DIV> <DIV> </DIV> <DIV>pZImage->GetPointData()->SetScalars( pScalars );</DIV> <DIV> </DIV> <DIV>vtkJPEGWriter *pImageWriter = vtkJPEGWriter::New();</DIV> <DIV>pImageWriter ->SetInput( pZImage );</DIV> <DIV>pImageWriter ->SetQuality( 100.0 );</DIV> <DIV>pImageWriter ->SetFileName( strImageFile );</DIV> <DIV>pImageWriter ->ProgressiveOff();</DIV> <DIV>pImageWriter ->Write();</DIV> <DIV> </DIV> <DIV>*************************************************************************************************</DIV> <DIV> </DIV> <DIV>I am sure there should be many ways.......</DIV> <DIV> </DIV> <DIV>Thanks in advance</DIV> <DIV> </DIV> <DIV>Regards,</DIV> <DIV> </DIV> <DIV>Deepak Roy<BR></DIV><p>
        
                <hr size=1>Yahoo! Shopping<br>
Find Great Deals on Holiday Gifts at <a href="http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1
">Yahoo! Shopping</a>