imglib2: more efficent alternative to PointSetRegionOfInterest

46 views
Skip to first unread message

sara

unread,
Dec 13, 2013, 4:39:16 AM12/13/13
to fiji-...@googlegroups.com

Hi everyone!

I'm using a PointSetRegionOfInterest for selecting points above a threshold value in an Img. The roi is used as a mask so I often need to call the 'contains' method, which is resulted to be very slow as the roi is composed of a huge number of points. I wonder if there is a more efficent alternative.

What I need is to select all the points above the threshold value and perform some operations only on those points of the Img.

I think that the View class could be a good alternative but I don't know how to actually use it with sparse points. In order to obtain a View of an Img from a GeneralPointSet I've tried the method Views.interval(sourceImg,generalPointSet), anyway when using the resulting IntervalView as an input Img in the method ImageCombiner.applyOp(..) the output obtained doesn't match.

Thanks a lot,

Sara

Barry DeZonia

unread,
Dec 13, 2013, 12:55:37 PM12/13/13
to sara, fiji-devel
Hi Sara,

PointSets and Views may not interoperate well at the moment. If you are going to use PointSets I would suggest the following:

Assuming your GeneralPointSet contains the points of interest:
Create a ConditionalPointSet from your GeneralPointSet.
The Condition to pass in the constructor can be a WithinRangeCondition
The Function to pass to the WithinRangeCondition should be a RealImageFunction (constructed  on your Img)

Now you can iterate the ConditionalPointset and the points you get back are only those that satisfy the condition. You can use random access into an image using the points returned. This should be more performant. I hope that helps.


--
--
Please avoid top-posting, and please make sure to reply-to-all!
 
Mailing list web interface: http://groups.google.com/group/fiji-devel
 
---
You received this message because you are subscribed to the Google Groups "Fiji-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fiji-devel+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Barry DeZonia

unread,
Dec 13, 2013, 2:12:15 PM12/13/13
to sara, fiji-devel
Note also that you can create a GeneralPointSet from any other PointSet (like a RoiPointSet) using GeneralPointSet.explode(pointset). The series of contains calls are then made once during the construction of the GeneralPointSet. Afterwards you can iterate it as often as you like.

arya...@gmail.com

unread,
Dec 23, 2013, 4:41:58 AM12/23/13
to fiji-...@googlegroups.com, sara
Hi Barry! 
Sorry for the late answer but in this period I've been working on another project, anyway your answer was very useful: now there are no more efficency problems, so thanks a lot!

Sara

Barry DeZonia

unread,
Dec 23, 2013, 4:09:12 PM12/23/13
to Brienne Talos, fiji-devel
Hi Sara,

I'm glad I could help and that your problem is resolved. Regards, Barry
Reply all
Reply to author
Forward
0 new messages