Why imshow is not working?
조회 수: 1 (최근 30일)
이전 댓글 표시
I try to read a txt with rows and columns as many as dicom images are and align the images in accordance to x,y values that are written on this txt.
Finally, I try to imshow them but although no error occurs, still the RUN process stops and nothing happens. Can you explain why?
Here is the code I use
filePatternu = fullfile(destinationFolder, '*.dcm');
allFiles = dir(filePatternu);
for k= 2: 1: length(allFiles)
baseFileName = allFiles(k).name; % e.g. "1.png"
fullFileName = fullfile(destinationFolder, baseFileName);
I = dicomread(fullFileName); % img respresents input image.
pause(2)
[x, y] = textread('imgpositions.txt', '%f , %f');
figure
imshow(I, [x y])
drawnow;
end
댓글 수: 3
Siyu Guo
2018년 5월 1일
I think the first thing to do is to determine where the execution is suspended. Try add some interactions by "input('press any key...', 's');" after statements in the loop to investigate the bottleneck.
John D'Errico
2018년 5월 1일
편집: John D'Errico
2018년 5월 1일
I'm not sure what you think it does. But from the help for imshow, we see:
imshow(I,[LOW HIGH]) displays the grayscale image I, specifying the display
range for I in [LOW HIGH]. The value LOW (and any value less than LOW)
displays as black, the value HIGH (and any value greater than HIGH) displays
as white. Values in between are displayed as intermediate shades of gray,
using the default number of gray levels.
the form
imshow(I,[x,y])
is NOT designed to montage a set of images.
You cannot just make up a meaning for the inputs to a function and hope that it will understand your purpose. So if you call imshow as you did, it will try to display ONE image, with a pixel value of x shown as black, and y as white.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!