[vtkusers] Identifying/Extracting the largest object (fwd)
R K Shyamprakash
ramakrishna.prakash at quest-global.com
Wed Jun 11 11:04:14 EDT 2003
Did you have a look at vtkPolyDataConnectivityFilter?
try using it with
vtkPolyDataConnectivityFilter.SetExtractionModeToLargestRegion()
Shyam
-----Original Message-----
From: vtkusers-admin at public.kitware.com
[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Michael S. Vaz
Sent: Wednesday, June 11, 2003 8:19 PM
To: vtkusers at public.kitware.com
Subject: [vtkusers] Identifying/Extracting the largest object (fwd)
I need to identify and extract the largest object from a binary 3D image
and can't seem to find a function in VTK to do this. In MATLAB R13 this
is rather simple:
con_param = 26 % set connectivity parameter to the strictest setting
% T1 is the eroded binary 3D image (3D mtx)
[L,num_connected_objs] = bwlabeln(T1,con_param);
a = hist(L(:),[0:num_connected_objs]);
[v,ind] = max([a(2:end)]); %v = max (single value), "ind" is vect.
T2 = (L==ind); % T2 will set just the largest object to 1
% while everything else will be the background (=0)
As am unable to find an eqivalent function to bwlabeln in python or vtk.
I found a reference to some python code that will remove all the small
objects from a Google search of [+python +segment +"largest object"], but
unfortunately the source code no longer exists in the library the that
link points to.
If you know of some function code that will help me please let me know.
Also, if anyone has suggestions to make the solution elegant,
should the function need to be implemented, please let me know. The
MATLAB algorithm is not exposed for bwlabeln().
Thanks,
Sarju
Michael S. Vaz
324607 Georgia Tech Station
Atlanta Georgia, 30332
Internet: gte631d at prism.gatech.edu
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list