<DIV>
<DIV>
<DIV><BR>hi</DIV>
<DIV> </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> </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> static vtkMyCallback *New() <BR> { return new vtkMyCallback; }<BR> virtual void Execute(vtkObject *caller, unsigned long, void*)<BR> {<BR> vtkTransform *t = vtkTransform::New();<BR> vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);<BR> widget->GetTransform(t);<BR> widget->GetProp3D()->SetUserTransform(t);<BR> }<BR>};</DIV>
<DIV>int main( int argc, char *argv[] )<BR>{<BR> vtkImageReader *Reader = vtkImageReader::New();<BR> Reader-> SetHeaderSize (0); <BR> Reader->SetDataExtent (0,199,0,199,0,99);<BR> Reader->SetDataSpacing(1.0,1.0,1.0);<BR> Reader->SetDataScalarTypeToUnsignedChar();<BR> Reader->SetDataByteOrderToLittleEndian();<BR> Reader->SetFileDimensionality(3);<BR> Reader->SetFileName("d:/bym280602b");<BR> Reader->SetDataMask(0x7fff);</DIV>
<DIV><BR> vtkPiecewiseFunction *oTFun =vtkPiecewiseFunction::New();<BR> oTFun->AddSegment(32,0,255,1.0);<BR> vtkPiecewiseFunction *gTFun =vtkPiecewiseFunction::New();<BR> gTFun->AddSegment(0,1.0,5,1.0);<BR> <BR> vtkVolumeProperty *volProperty = vtkVolumeProperty::New();<BR> volProperty->SetColor(gTFun);<BR> volProperty->SetScalarOpacity(oTFun);<BR> volProperty->SetInterpolationTypeToLinear();<BR> volProperty->ShadeOn();<BR> <BR> vtkVolumeRayCastCompositeFunction *compositeFunction= vtkVolumeRayCastCompositeFunction::New();<BR> volMapper = vtkVolumeRayCastMapper::New();<BR> volMapper->SetInput(Reader->GetOutput()); <BR> volMapper->SetVolumeRayCastFunction(compositeFunction);</DIV>
<DIV> </DIV>
<DIV> vol=vtkVolume::New();<BR> vol->SetMapper(volMapper); <BR> vol->SetProperty(volProperty);<BR><BR> ren=vtkRenderer::New();<BR> ren->AddVolume(vol); <BR> <BR> <BR> renwin=vtkRenderWindow::New();<BR> renwin->AddRenderer(ren);<BR> renwin->SetSize(500,500);</DIV>
<DIV> iren=vtkRenderWindowInteractor::New();<BR> iren->SetRenderWindow(renwin);</DIV>
<DIV> vtkInteractorStyleTrackballCamera *style = <BR> vtkInteractorStyleTrackballCamera::New();<BR> iren->SetInteractorStyle(style);</DIV>
<DIV> vtkBoxWidget *boxWidget = vtkBoxWidget::New();<BR> boxWidget->SetInteractor(iren);<BR> boxWidget->SetPlaceFactor(1);</DIV>
<DIV> boxWidget->SetProp3D(vol);<BR> boxWidget->PlaceWidget();<BR> vtkMyCallback *callback = vtkMyCallback::New();<BR> boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);</DIV>
<DIV> boxWidget->On();</DIV>
<DIV> iren->Initialize();<BR> iren->Start();<BR> <BR> return 0;<BR>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR> Thanks for help</DIV>
<DIV> </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>