I am doing my project in medical imaging. I am getting "index exceeds matrix dimensions" while trying to segment the lungs. please help me

1 回表示 (過去 30 日間)
I = im2double(imread('onee.png'));
I=I(:,:,1);
cropped = I(50:430,8:500); %%Crop region of interest
thresholded = cropped < 0.35; %%Threshold to isolate lungs
clearThresh = imclearborder(thresholded); %%Remove border artifacts in image
Liver = bwareaopen(clearThresh,100); %%Remove objects less than 100 pixels
Liver1 = imfill(Liver,'hole'); % fill in the vessels inside the lungs
imshow(Liver1.*cropped)
  2 件のコメント
Stephen23
Stephen23 2014 年 9 月 2 日
編集済み: Stephen23 2014 年 9 月 2 日
Please edit your question by formatting your code to be more readable: this will encourage people to read and understand what you are trying to do. You will find some buttons immediately above the text field, allowing you to add some basic formatting. Use the "{} Code" button to format any code, keeping the code tidy, eg one line per line of code. Pay attention to the "Preview" pane underneath too!
Some explanation of what you understand, what you are trying and what you expect would be useful information for potential helpers here...
Ank
Ank 2014 年 9 月 2 日
編集済み: Walter Roberson 2015 年 11 月 17 日
I(50:430,8:500)
may be this line.
what is the size of the image is it more than 430x500? If no then you are accessing values outside the matrix hence the error.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2014 年 9 月 2 日
Put this line right before your crop:
[rows, columns] = size(I)
What do you see? Are there at least 430 rows and 500 columns? No, there are not.

カテゴリ

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