Extremely slow imshow() when using 16-bit images
이전 댓글 표시
I'm starting by taking a matrix of data from a DICOM file and making it indexed (so that I can apply a user-specified colormap).
shades = 2^bit_val
grayData = mat2gray(dicomData);
% Limiting to shades-1 to allow for a special mark-up color
indexedData = gray2ind(data, shades-1);
%Then code to calculate cmap with the special color at the end
...
imshow(indexedData, cmap, handles.Axes);
If bit_val is 8, then the code takes 0.01 seconds to display which is fine. However, if bit_val is 16, then it takes nearly a whole second to display.
The primary issue is that I want to be able to quickly/smoothly switch between different slices being displayed.
Is there any way to improve the rendering time?
Edit:
According to Wikipedia's entry for palette ( http://en.wikipedia.org/wiki/Palette_%28computing%29#System_and_logical_palettes_under_Microsoft_Windows )
Under Windows, "When a given application intends to output colorized graphics and/or images, it can set their own logical palette, that is, its own private selection of colors (up to 256)."
Perhaps this explains why an 8-bit color map (with only 256 colors) displays faster than a 16-bit color map (with 65536 colors) on Windows.
댓글 수: 3
Walter Roberson
2012년 12월 12일
Which platform are you using? I have read that MS Windows is not designed to be able to handle colormaps with more than 256 entries.
Sean de Wolski
2012년 12월 12일
How are you timing it?
Christopher
2012년 12월 14일
답변 (1개)
Sean de Wolski
2012년 12월 12일
편집: Sean de Wolski
2012년 12월 12일
X = uint16(rand(1000)*60000);
t = 0;
figure;ax = axes;
for ii = 1:10
tic;
imshow(X,'parent',ax);
drawnow;
t = t+toc;
cla;
drawnow;
end
disp(t/10);
% 0.0335 on my system
Also Have you seen implay()?
doc implay
댓글 수: 4
Christopher
2012년 12월 14일
편집: Christopher
2012년 12월 14일
Image Analyst
2012년 12월 14일
You don't need to put tic and toc inside a disp() function.
Sean de Wolski
2012년 12월 17일
@Christopher: Put this in a loop (like I did) and run it in a script file. That way you don't get any overhead that may be introduced by the command window.
Christopher
2012년 12월 17일
편집: Christopher
2012년 12월 17일
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!