Insufficient memory warnings and failure when trying to display large 3d data with volshow as blokedImage while using OverlayData
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello,
I have some biomedical 3D data that I want to display with volshow. Because some array dimensions of my data are larger than 2048 I use blockedImage.
Now I get the following warnings multiple times when I try to display this data with the OverlayData propertiy of volshow:
Warning: Insufficient memory. Viewer3D will attempt to render a downsampled version of the scene. Consider converting volumes into a 3-D
blockedImage.
The viewer opens and is working but fails to render anything. Finally, I recieve the message:
Warning: Insufficient memory. Viewer3D will attempt to render a downsampled version of the scene. Consider converting volumes into a 3-D
blockedImage.
I'm confused by this because I already use blockedImage. By trying to solve this problem, I discovered that this happens when the dimenson product of my data array reaches 2*1024³, independet of datatype (thats why I didn't write 2GB). However, I have no problems when using no OverlayData, even with volumes more than twice as large.
A simple code to reproduce this problem would be:
V = ones(2048,2048,512,'uint8');
bim = blockedImage(V,BlockSize=[512 512 512]);
volshow(bim,OverlayData=bim);
As soon I decrease the dimension by a tiny bit, I have no problems. Memory should be also no problem on my machine. 64 GB RAM that is shared with the iGPU up to 32 GB.
Another thing is that I previously had no problems with an odler version of MATLAB rendering my data last year. I think it was 2023a. I also tried it now with 2023b and my data works fine, however, when using the sample code above, the viewer doesn't even open and matlab is stuck "busy". But this seems to be another problem.
Could pls help me fixing this issue with the current MATLAB 2024a version?
Best regards,
Sebastian
댓글 수: 0
채택된 답변
Aravind
2024년 8월 27일
Hi Sebastian,
I'm facing the same issue in R2024a, and it seems like there is a bug in the “volshow” function. I tried it out in the latest Prerelease of MATLAB R2024b, and it seems to work there. Given that it works in the Prerelease version, it's likely that MathWorks will fix the issue in the stable R2024b release. For now, you might want to try using the latest Prerelease of R2024b to run your code.
추가 답변 (1개)
Tim Jackman
2024년 9월 9일
Hi Sebastian and Aravind,
Thank you for reporting/discussing this issue with volshow. I can confirm that this will be fixed in the R2024b release, and it will also be fixed in the next available R2024a update.
Additionally, this is an active area of development for us so we would love hear more about what you need to get the most out of these visualizations. If you would like to share more about what you are doing, and any features that would make your work easier, please contact tech support and refer to this post.
Thanks!
Tim
댓글 수: 4
Tim Jackman
2024년 9월 16일
Thanks for sending the request in. Looking through the reproduction steps:
%% Problematic Code
load("spiralVol.mat")
Vb = uint8(spiralVol > 0);
sz = size(Vb);
% depth-depending values used for colormap
clridx = uint8(1:sz(3));
clridx = reshape(clridx,1,1,sz(3));
Vc = Vb(:,:,1:sz(3)).*clridx;
bim = blockedImage(Vc,BlockSize=[100 100 sz(3)]);
propV.Colormap = [0 0 0; jet(sz(3))];
propV.Alphamap = [0;ones(sz(3),1)]; % Fully opaque nonzero values
vwr = viewer3d(Lighting="off");
h = volshow(bim,propV,Parent=vwr);
I think the root cause of the issue is that the default interpolation method used by volshow when determining what the color and transparency should be at locations between voxels is "bilinear". In a case with data like yours that has an opaque/colored voxels directly next to transparent voxels and you don't want to render any transition between the two voxels, switching the Interpolation to "nearest" should give you the result you want without needing to use OverlayData and the "LabelOverlay" rendering style.
h.Interpolation = "nearest";
Now, this property on the Volume object is not documented, but we will work on getting it documented as soon as possible. In the mean time its perfectly fine to use either the "nearest" or "bilinear" options of the property. Thanks for following up with this!
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!