[vtkusers] PCA on vtkImageData
Andrew Crozier
andrew.crozier at medunigraz.at
Mon Nov 17 12:25:14 EST 2014
I wrote it out with vtkUnstructuredGridWriter and loaded it up in
Paraview. Showing it there with a 'Points' or '3D Glyphs' representation
shows only vertices on the external surface of the specified region.
(Python) code I used to generate:
tf = vtk.vtkThreshold()
tf.SetInput(img)
tf.ThresholdBetween(1.5,2.5)
tf.Update()
op = tf.GetOutput()
writer = vtk.vtkUnstructuredGridWriter()
writer.SetFileName('thresh.vtk')
writer.SetInput(op)
writer.Write()
Andrew
On 17/11/14 17:40, David Gobbi wrote:
> Hi Andrew,
>
> It should export all the points in the volume, as long as they are
> within the applied thresholds. What is your evidence that it's only
> exporting the boundary?
>
> - David
>
> On Mon, Nov 17, 2014 at 9:34 AM, Andrew Crozier
> <andrew.crozier at medunigraz.at <mailto:andrew.crozier at medunigraz.at>>
> wrote:
>
> Hi David,
>
> Thanks for the suggestion. I looked at the vtkThreshold filer,
> however it appears to export the boundary of the thresholded
> volume, whereas I require all points inside the volume. Have you
> any idea of how to achieve that?
>
> BW,
> Andrew
>
>
> On 17/11/14 17:16, David Gobbi wrote:
>> Hi Andrew,
>>
>> The vtkThreshold filter will extract only the cells with the desired
>> scalar values, and will output them as an unstructured grid. It
>> isn't exactly what you want because it extracts cells, rather than
>> points, but it might be worth a shot.
>>
>> - David
>>
>> On Mon, Nov 17, 2014 at 8:28 AM, Andrew Crozier
>> <andrew.crozier at medunigraz.at
>> <mailto:andrew.crozier at medunigraz.at>> wrote:
>>
>> Hi,
>>
>> I am trying to evaluate the principal components of a
>> strucutre in a 3D volume image, to determine its spatial
>> alignment for use in an automatic processing pipeline.
>>
>> The input is a vtkImageData, with multiple integer values
>> (say, 0, 1, 2 and 3), and I want to perform PCA on the
>> positions of all voxels with value 2, for example.
>>
>> I have looked at vtkPCAAnalysisFilter, and this requires an
>> input of vtkPointSet. vtkImageDataToPointSet converts a
>> vtkImageData to a vtkStructuredGrid, however I expect this to
>> include all points in the original image. At the moment I
>> seem to be missing some way of filtering out the points other
>> than those of value 2.
>>
>> Any help provided for this would be greatly appreciated!
>>
>> Best wishes,
>> Andrew Crozier
>>
>
> --
> ------------------------------------------------------------------------
> *Andrew Crozier*
> andrew.crozier at medunigraz.at <mailto:andrew.crozier at medunigraz.at>
>
> Postdoctoral Researcher
> Institute for Biophysics
> Medical University of Graz
>
>
--
------------------------------------------------------------------------
*Andrew Crozier*
andrew.crozier at medunigraz.at
Postdoctoral Researcher
Institute for Biophysics
Medical University of Graz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141117/cd2fc2e5/attachment.html>
More information about the vtkusers
mailing list