JuliaImages / JuliaImages/ImageSegmentation.jl

Problem with Graph Construction from Segmented Image

Open
#94 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
45
Forks
22
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,
At the moment I’m working on a master thesis, which topic is connected with biomedical image processing. I am writing to you regarding an issue that I am experiencing with the JuliaImages library.
The error occurs during the construction of a graph from a segmented image obtained by computing the watershed algorithm.
My Julia code processes high-resolution histological images, whose size can range from 30 MB to 1.8 GB. The error that is generated is an Out Of Memory error and it occurs after about 10 minutes from the beginning of the graph construction process. I have 128 GB of memory + 8 GB of Swap available, is there a possible solution to overcome the problem and generate the graph without the risk of OOM?
To try to reduce the chances of OOM, I modified the "region_adjacency_graph" function by removing the parts related to edge weights and consequently also the function for calculating weights. Nevertheless, the OOM scenario still occurs.

Below are the lines of code I use to segment the image and build the graph:
img = ImageMagick.load_(svs_image) # load image
bw = Gray.(img) .> 0.21
dist = 1 .- distance_transform(feature_transform(bw))
markers = label_components(dist .< -0.00001)
segments = watershed(dist, markers)
weight_fn(i,j) = euclidean(segment_pixel_count(segments,i), segment_pixel_count(segments,j)) #not used
G, vert_map = region_adjacency_graph(segments)

For further information regarding the structure of the images to be segmented (svs_image), I am leaving the link to the package: https://github.com/niccolo99mandelli/JHistint.jl/tree/main/output_example. The image can be found in the "output_example" folder under the name "SlideExample.tif.

Thank you for your attention in advance.
Niccolò Mandelli, University of Milano-Bicocca

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported failure in region_adjacency_graph using the segmentation code and the SlideExample.tif file from the linked JHistint.jl output_example folder. Inspect the graph-construction inputs and determine what causes the out-of-memory condition; done means identifying a reproducible cause and a documented solution or clear limitation for these large images.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.