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
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
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
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!