[vtkusers] Converting a point on a vtkActor to an Image coordinate
Bill Lorensen
bill.lorensen at gmail.com
Mon Dec 5 23:24:37 EST 2011
Have you tried vtkPointPicker?
Once you have the xyz, you can compute the image coordinates something
like this:
Since
xyz = origin + ijk * spacing
ijk = (xyz - origin) / spacing
On Sun, Dec 4, 2011 at 1:12 PM, Shaan Malik <shaanmalikother at gmail.com> wrote:
> Hi Scott,
>
> Sorry, to clarify, my pipeline is as follows:
>
> vtkImageData->vtkMarchingCubes->vtkPolyDataMapper->vtkActor->vtkRenderer->vtkRenderWindow
>
> I have a vtkActor which I'm trying to pick, not a vtkImageActor.
>
> What I'm trying to do is, once a point on the vtkActor is picked, figure out
> which point in the original vtkImageData it corresponds to.
>
> Thanks for the reply,
> Shaan
>
>
> On 02/12/11 16:17, Scott Johnson wrote:
>>
>> Hello Shaan,
>>
>> If you have a vtkImageActor it will be returned as a valid pick by
>> vtkPropPicker. If you look at the actor returned it is probably your image
>> actor. Also, vtkPropPicker won't pick an actor representing a vtkPolyData
>> shape described as line cells, even if it's closed. In order to get it to
>> pick, the vtkPolyData it must contain closed cells such as polygons.
>>
>> You can prevent vtkImageActor from being selected by using the PickList
>> functionality in vtkPropPicker.
>>
>> -- Scott
>>
>> -----Original Message-----
>> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
>> Of Shaan Malik
>> Sent: Friday, December 02, 2011 9:53 AM
>> To: vtkusers at vtk.org
>> Subject: [vtkusers] Converting a point on a vtkActor to an Image
>> coordinate
>>
>> I've produced an actor from vtkMarchingCubes, which takes a vtkImageData
>> as input.
>> I want to be able to select the actor in a view and convert the selected
>> point on the actor to the corresponding point on the original image.
>>
>> In order to get an actor position, I'm using a vtkPicker, but sometimes
>> clicking not on the actor, the picker returns what it thinks is a valid
>> point on the actor. At first I thought this was because the bounding box the
>> Picker uses wasn't a tight fit, but actually the points it returns can fall
>> outside the bounding box of the actor. This makes me assume vtkPicker can't
>> be used to reliably check if a position falls on the actor or not?
>> The second stage would be to convert the actor position to a position on
>> the original image, but I'm not sure how to go about doing this.
>>
>> I'm trying to implement a similar feature to what occurs in ITKSNAP, where
>> clicking on a segmentation changes the positions of the orthogonal views.
>>
>> Hope someone can help,
>>
>> Thanks,
>> Shaan
>>
>>
>> _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> 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
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtkusers
mailing list