<DIV>
<DIV>
<DIV><BR>hi</DIV>
<DIV>&nbsp;</DIV>
<DIV>i have used vtkBoxWidget for scaling my volume data and it works fine except that the image and the widget and not aligned.</DIV>
<DIV>When i scale the volume or rotate it , it moves out of the widget.</DIV>
<DIV>Please suugest a solution for this.</DIV>
<DIV>I am including my code here</DIV>
<DIV>&nbsp;</DIV>
<DIV>vtkRenderWindowInteractor *iren;<BR>vtkVolume *vol;</DIV>
<DIV>vtkRenderWindow *renwin;<BR>vtkRenderer *ren;<BR>vtkCamera *cam;<BR>vtkVolumeRayCastMapper *volMapper;<BR>class vtkMyCallback : public vtkCommand<BR>{<BR>public:<BR>&nbsp; static vtkMyCallback *New() <BR>&nbsp;&nbsp;&nbsp; { return new vtkMyCallback; }<BR>&nbsp; virtual void Execute(vtkObject *caller, unsigned long, void*)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkTransform *t = vtkTransform::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkBoxWidget *widget = reinterpret_cast&lt;vtkBoxWidget*&gt;(caller);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; widget-&gt;GetTransform(t);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; widget-&gt;GetProp3D()-&gt;SetUserTransform(t);<BR>&nbsp;&nbsp;&nbsp; }<BR>};</DIV>
<DIV>int main( int argc, char *argv[] )<BR>{<BR>&nbsp;vtkImageReader *Reader = vtkImageReader::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Reader-&gt; SetHeaderSize (0); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetDataExtent (0,199,0,199,0,99);<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Reader-&gt;SetDataSpacing(1.0,1.0,1.0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetDataScalarTypeToUnsignedChar();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetDataByteOrderToLittleEndian();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetFileDimensionality(3);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetFileName("d:/bym280602b");<BR>&nbsp;&nbsp;&nbsp;&nbsp; Reader-&gt;SetDataMask(0x7fff);</DIV>
<DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp; vtkPiecewiseFunction *oTFun =vtkPiecewiseFunction::New();<BR>&nbsp;&nbsp;&nbsp; oTFun-&gt;AddSegment(32,0,255,1.0);<BR>&nbsp;vtkPiecewiseFunction *gTFun =vtkPiecewiseFunction::New();<BR>&nbsp;&nbsp;&nbsp; gTFun-&gt;AddSegment(0,1.0,5,1.0);<BR>&nbsp; &nbsp;<BR>&nbsp;&nbsp; vtkVolumeProperty *volProperty = vtkVolumeProperty::New();<BR>&nbsp;&nbsp;&nbsp; volProperty-&gt;SetColor(gTFun);<BR>&nbsp;volProperty-&gt;SetScalarOpacity(oTFun);<BR>&nbsp;volProperty-&gt;SetInterpolationTypeToLinear();<BR>&nbsp;volProperty-&gt;ShadeOn();<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; vtkVolumeRayCastCompositeFunction *compositeFunction= vtkVolumeRayCastCompositeFunction::New();<BR>&nbsp;volMapper = vtkVolumeRayCastMapper::New();<BR>&nbsp;&nbsp;&nbsp; volMapper-&gt;SetInput(Reader-&gt;GetOutput()); <BR>&nbsp;volMapper-&gt;SetVolumeRayCastFunction(compositeFunction);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;vol=vtkVolume::New();<BR>&nbsp;vol-&gt;SetMapper(volMapper);&nbsp; <BR>&nbsp;vol-&gt;SetProperty(volProperty);<BR><BR>&nbsp;ren=vtkRenderer::New();<BR>&nbsp;&nbsp; ren-&gt;AddVolume(vol);&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; renwin=vtkRenderWindow::New();<BR>&nbsp;&nbsp;&nbsp;renwin-&gt;AddRenderer(ren);<BR>&nbsp;&nbsp;&nbsp; renwin-&gt;SetSize(500,500);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; iren=vtkRenderWindowInteractor::New();<BR>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renwin);</DIV>
<DIV>&nbsp; vtkInteractorStyleTrackballCamera *style = <BR>&nbsp;&nbsp;&nbsp; vtkInteractorStyleTrackballCamera::New();<BR>&nbsp; iren-&gt;SetInteractorStyle(style);</DIV>
<DIV>&nbsp;&nbsp; vtkBoxWidget *boxWidget = vtkBoxWidget::New();<BR>&nbsp; boxWidget-&gt;SetInteractor(iren);<BR>&nbsp; boxWidget-&gt;SetPlaceFactor(1);</DIV>
<DIV>&nbsp; boxWidget-&gt;SetProp3D(vol);<BR>&nbsp; boxWidget-&gt;PlaceWidget();<BR>&nbsp; vtkMyCallback *callback = vtkMyCallback::New();<BR>&nbsp; boxWidget-&gt;AddObserver(vtkCommand::InteractionEvent, callback);</DIV>
<DIV>&nbsp;boxWidget-&gt;On();</DIV>
<DIV>&nbsp; iren-&gt;Initialize();<BR>&nbsp; iren-&gt;Start();<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp; return 0;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;Thanks for help</DIV>
<DIV>&nbsp;</DIV>
<DIV>Megha</DIV></DIV></DIV><p><font face=arial size=-1>
<a href="http://in.rd.yahoo.com/specials/mailtag/*http://in.insurance.yahoo.com/licspecial/index.html" target="_blank"><b>Yahoo! India Insurance Special</a>:</b> Be informed on the best policies, services, tools and more.</font>