[vtkusers] Inverted Crop
Alessandro Martini
alessandromartini at gmail.com
Tue Aug 10 02:38:49 EDT 2010
I'm using a clipping example of GPURenderDemo, with a Box and a Callback,
the boxWidget has only InsideOutOff() and InsideOutOn() options, and no one
of then work like I want.
I'm doing anything wrong?
//---------------------------------------------------------------------------
class vtkBoxWidgetCallback : public vtkCommand
{
public:
static vtkBoxWidgetCallback *New()
{ return new vtkBoxWidgetCallback; }
virtual void Execute(vtkObject *caller, unsigned long, void*)
{
vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);
if (this->Mapper)
{
vtkPlanes *planes = vtkPlanes::New();
widget->GetPlanes(planes);
this->Mapper->SetClippingPlanes(planes);
planes->Delete();
}
}
void SetMapper(vtkSmartVolumeMapper* m)
{ this->Mapper = m; }
protected:
vtkBoxWidgetCallback()
{ this->Mapper = 0; }
vtkSmartVolumeMapper *Mapper;
};
//---------------------------------------------------------------------------
vtkBoxWidget *box = vtkBoxWidget::New();
box->SetInteractor(vtkWindow1->GetInteractor());
box->SetPlaceFactor(1.01);
box->SetInput(mapperG->GetInput());
box->SetDefaultRenderer(vtkWindow1->GetRenderer());
box->TranslationEnabledOn();
box->ScalingEnabledOn();
box->RotationEnabledOn();
box->PlaceWidget();
vtkPlanes *planes = vtkPlanes::New();
box->GetPlanes(planes);
box->InsideOutOn();
mapperG->SetClippingPlanes(planes);
planes->Delete();
vtkBoxWidgetCallback *callback = vtkBoxWidgetCallback::New();
callback->SetMapper(mapperG);
box->AddObserver(vtkCommand::InteractionEvent, callback);
callback->Delete();
box->EnabledOn();
box->GetSelectedFaceProperty()->SetOpacity(0.0);
On Mon, Aug 9, 2010 at 9:53 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:
> If you are using an implicit function for your selection, then you can
> use the Clip filter and just set the InsideOut value to 1.
>
> Seb
>
> On Mon, Aug 9, 2010 at 6:52 PM, Alessandro Martini
> <alessandromartini at gmail.com> wrote:
> > Hello All,
> >
> > I need to do a inverted crop in a volume, mantain the content external to
> > box ( selection ) and hide the internal content, make any like a "hole".
> > What is the correct way? Have any example of this ?
> >
> > Thank's,
> > --
> > Alessandro Martini
> > alessandromartini at gmail.com
> > -------------------------------------------------
> > 'Existem 10 tipos de pessoas no mundo:
> > aquelem que entendem binário, e aqueles que não!'
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
--
Alessandro Martini
alessandromartini at gmail.com
-------------------------------------------------
'Existem 10 tipos de pessoas no mundo:
aquelem que entendem binário, e aqueles que não!'
--
Alessandro Martini
alessandromartini at gmail.com
-------------------------------------------------
'Existem 10 tipos de pessoas no mundo:
aquelem que entendem binário, e aqueles que não!'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100810/f52f6a82/attachment.htm>
More information about the vtkusers
mailing list