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!