[vtkusers] Inverted Crop

Sebastien Jourdain sebastien.jourdain at kitware.com
Tue Aug 10 08:47:10 EDT 2010


The clipping that you are doing is on the mapper, which is not what I
was talking about.

This is what I was talking about:
http://www.vtk.org/Wiki/VTK/Examples/Widgets/ImplicitPlaneWidget2

You will just need some few adjustment, but everything is there.

Seb

On Tue, Aug 10, 2010 at 2:38 AM, Alessandro Martini
<alessandromartini at gmail.com> wrote:
>
> 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!'
>
> _______________________________________________
> 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
>
>



More information about the vtkusers mailing list