Why imshow is not working?

1 回表示 (過去 30 日間)
Stelios Fanourakis
Stelios Fanourakis 2018 年 5 月 1 日
編集済み: John D'Errico 2018 年 5 月 1 日
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
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
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 件)

カテゴリ

Help Center および File ExchangeMedical Physics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by