Apply segmentation to a large binary image

Juan Nunez-Iglesias jni.soma at gmail.com
Sat Apr 4 09:02:27 EDT 2015


Hey Yuta,




I'm not sure how much h5py mirrors the numpy array interface, but I suspect not sufficiently to allow C/Cython functions to work. I think you'll need to find a clever way to partition your image to get the right result, because although you can use numpy.memmap [1] to use an on-disk array, I think that might be far too slow (since binary fill holes uses quite a few iterations...




Juan.




[1] http://docs.scipy.org/doc/numpy/reference/generated/numpy.memmap.html

On Sat, Apr 4, 2015 at 12:54 AM, Yuta Sato <yutaxsato at gmail.com> wrote:

> Dear Juan Nunez-Iglesias and Josh Warner:
> Thanks for your kind responses.
> Lets take a more simpler case, e.g., binary_fill_holes.
> I want to apply to the WHOLE image at once, because if I apply it in the
> parts of image and later combine, the result differs.
> Does putting the image into hdf5 and applying the binary_fill_holes solve
> my problem?
> Can I really apply binary_fill_holes to hdf5 file?
> Thanks for your helps.
> Yuta
> On Sun, Mar 15, 2015 at 10:18 AM, Juan Nunez-Iglesias <jni.soma at gmail.com>
> wrote:
>> Josh, you might be thinking of morphology.remove_small_objects, but that
>> is O(image.size), rather than O(sum(image == label)), which is what you are
>> after. In fact we would need a flood-fill algorithm, which we don't have...
>> That would be a fantastic addition.
>>
>>
>>
>>
>> On Sun, Mar 15, 2015 at 10:24 AM, Josh Warner <silvertrumpet999 at gmail.com>
>> wrote:
>>
>>> Would it be possible to generalize / refactor `clear_border` to a
>>> function which removes all points connected to a specific pixel/voxel? That
>>> would greatly simplify the work needed here.
>>>
>>> I thought we had some sort of `remove_object` functionality like this,
>>> but I don't see it.
>>>
>>> Josh
>>>
>>> On Friday, March 13, 2015 at 9:04:12 PM UTC-5, Juan Nunez-Iglesias wrote:
>>>>
>>>> Hey Yuta,
>>>>
>>>> You'll need to do some stitching out-of-core. That's a really tricky
>>>> problem and I don't have any ready-made solutions for you. The solution
>>>> will depend on the nature of your segments. The only thing I would
>>>> recommend is that you use a format such as HDF5 (you can use the excellent
>>>> h5py library) that allows random access into the underlying disk data.
>>>>
>>>> Other than that, as I said, to my knowledge you'll have to develop your
>>>> own stitching: segment *overlapping* tiles independently in memory, and
>>>> when it comes time to write to disk, load the tile and overlapping tiles
>>>> that have already been segmented, and resolve label mapping then...
>>>>
>>>> Generally, think of it this way: tile i has already been segmented and
>>>> written out. We now want to write out tile j, which overlaps tile i. Labels
>>>> from tile i that intersect labels from tile j in the overlap region should
>>>> be matched. labels in tile j that *don't* intersect tile i should be
>>>> relabelled to ensure they are unique with respect to tile i.
>>>>
>>>> Of course this gets a bit more complicated in 2D or 3D...
>>>>
>>>> Juan.
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Mar 13, 2015 at 7:20 PM, Yuta Sato <yutaxsato at gmail.com> wrote:
>>>>
>>>>>  Dear SKIMAGE Developers and Users:
>>>>>
>>>>> I want to use the following algorithm in a large binary image that does
>>>>> not fit into my PC memory. So, I am thinking to split my large image into
>>>>> tiles and apply algorithm one by one. However, the original border
>>>>> definition change when I do it in parts. I need the result as applied in
>>>>> original full image. How can I do it efficiently?
>>>>>
>>>>> skimage.segmentation.clear_border(image, buffer_size=0, bgval=0)
>>>>>
>>>>> Thanks for your ideas.
>>>>>
>>>>> --
>>>>> 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+unsubscribe at googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>   --
>>> 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+unsubscribe at googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> 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+unsubscribe at googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> 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+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150404/54b9a936/attachment.html>


More information about the scikit-image mailing list