Why imshow is not working?
1 view (last 30 days)
Show older comments
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 Comments
Siyu Guo
on 1 May 2018
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
on 1 May 2018
Edited: John D'Errico
on 1 May 2018
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.
Answers (0)
See Also
Categories
Find more on Medical Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!