Yes, setting the vertical sampling value to a high value (i.e. 10000) did the trick. It makes sense since it is going to sample the the next pixel in a vertical position that does not exist in the image. With the right distance matrix I could use Josh's idea, as he suggested on the first reply. That was simpler than implementing something with several loops.
Thank you both, those were very quick and effective answers. :)
On Wednesday, July 16, 2014 1:16:34 AM UTC+1, Juan Nunez-Iglesias wrote:
@JDWarner, actually, instead of iterating, setting one of the sampling dimensions to a very large number should produce the desired output, no? =)
On Tue, Jul 15, 2014 at 11:13 AM, Josh Warner <silvertr...@gmail.com javascript:> wrote:
I don’t believe sampling works like this. The sampling= kwarg tells the algorithm the spacing of each pixel/voxel in each spatial dimension. It then calculates the distance transform. So if you put a zero in, it will traverse in that dimension with a distance cost of zero for each step. This will generate a result that has mostly spurious zero distances, rather than select a particular axis to calculate the distance transform along.
To calculate the correct distance function along a specific axis probably requires repeated calls along that axis; since scipy.ndimage is by definition n-dimensional it should be able to efficiently handle rank-1 arrays without issue.
I use the super handy Chrome extension “Markdown Here” to write in Markdown and then have my free entry fields converted to pretty HTML prior to posting. At this point I pretty much think in Markdown…
Josh
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout.