Color Thresholder tool runs out of memory

조회 수: 2 (최근 30일)
JSC
JSC 2021년 10월 22일
댓글: Ashish Uthama 2022년 5월 6일
I'm trying to use the Color Thresholder tool in the Image Processing Toolbox to segment and mask very large RGB whole-slide microscopy images (roughly 30,000 x 20,000 px on average). My images are compressed SVSs (a few hundred MB each), though I could make them TIFFs too if needed. After the tool loads the image and prompts me to select a color space, I do so and then the tool freezes and I receive the following message:
Warning: Error occurred while executing the listener callback for the images.internal.app.colorThresholder.ColorSpaceMontageView class
SelectedColorSpace property PostSet event:
Error using matlab.images.internal.rgb2hsv
Requested 42277x60589x3 (57.3GB) array exceeds maximum array size preference (15.9GB). This might cause MATLAB to become unresponsive.
Error in rgb2hsv (line 50)
h = matlab.images.internal.rgb2hsv(imageIn);
Error in images.internal.app.colorThresholder.ColorSegmentationTool/computeColorspaceRepresentation
Error in images.internal.app.colorThresholder.ColorSegmentationTool/colorSpaceSelectedCallback
Error in images.internal.app.colorThresholder.ColorSegmentationTool>@(hobj,evt)self.colorSpaceSelectedCallback(evt)
Error in images.internal.app.colorThresholder.ColorSpaceMontageView/selectFromButtons (line 161)
self.SelectedColorSpace = src.String;
Error in images.internal.app.colorThresholder.ColorSpaceMontageView>@(src,evt)self.selectFromButtons(src,evt) (line 148)
'Callback',@(src,evt) self.selectFromButtons(src,evt));
Related documentation
> In images.internal.app.colorThresholder/ColorSpaceMontageView/selectFromButtons (line 161)
In images.internal.app.colorThresholder.ColorSpaceMontageView>@(src,evt)self.selectFromButtons(src,evt) (line 148)
>>
Is there a way to increase the available memory for the thresholder tool or allow it to work with blockproc? I have already set the Java Heap Memory to max (4075 MB), compressed my image files, and reduced the pixel dimensions by 50%. I also tried using bigimage or blockedImage but it looks like they are incompatible with the tool.

채택된 답변

Image Analyst
Image Analyst 2021년 10월 22일
You should reduce the pixel dimensions by a factor of 50 or 100. There is no need to have such a huge image for determining the color thresholds. Believe it or not you will most likely end up deciding on the same thresholds if you have the full image or just a much smaller version. So resize it so that it's like 900 by 600 and you should be fine. It will fit in memory and you'll end up with the same thresholds you'd have if you had used the full size image. Remember, your screen doesn't have 30000 pixels across so you're making thresholding decisions on the overall image that can fit on your screen, which is probably 1920x1080 or something.
  댓글 수: 3
Image Analyst
Image Analyst 2021년 10월 25일
Of course. Yes, absolutely.
Ashish Uthama
Ashish Uthama 2022년 5월 6일
Exactly - that is usually the workflow. i.e read one of the lower resolution images - compute stats/thresholds and then 'apply' on the large image.
Here is an example.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

yanqi liu
yanqi liu 2021년 10월 23일
sir, may be use imresize to make image smaller can continue the processing.

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by