現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
I have mha file, how to do image segmentation of this data
6 ビュー (過去 30 日間)
古いコメントを表示
This is in continuation to a previous que which I already asked regarding readdata3d. dont know how to proceed further.....
Sir here is the data attached of brain mri scan. It's in mha format and is a 3d Image. We have to convert this 3d into a 2d image and use watershed algorithm to detect the tumor in the brain. The mha format is not being supported. Hence I am not able to upload it. If any email id is given I would send it.
I've used the following code:
[V,info]=ReadData3D
for slice = 1 : numberOfSlices
thisSlice = V(:,:, slice);
baseFileName = sprintf('Slice %d.png', slice);
fullFileName = fullfile('F:\final yr project', baseFileName);
imwrite(thisSlice, fullFileName);
end
The final image should be like the one I attached above.
The image should be gray scale analysed. So how to use these mha files to covert the 3d to above mentioned like pic. For further analysis using watershed
Can you please suggest me how this can be done and also can you please help me with the code if possible
31 件のコメント
Rik
2018 年 1 月 14 日
rohith bharadwaj
2018 年 1 月 14 日
I have a .mha file. I have to do watershed segmentation on the data to find a tumour. I don't know how to start. I am not able to handle .mha files. Ive tried ReadData3D but I'm getting an error, not able to resolve. how to import .mha files to matlab, plot them, covert the 3D image into many 2D images by slicing the 3D image into different layers
Jan
2018 年 1 月 14 日
Are you talking about https://www.mathworks.com/matlabcentral/fileexchange/29344-read-medical-data-3d? Please post much more details.
rohith bharadwaj
2018 年 1 月 14 日
編集済み: Walter Roberson
2018 年 1 月 15 日
ive typed ReadData3D in command window and loaded the .mha file.
I'm getting as:
RescaleSlope not available, assuming 1
RescaleIntercept not available, assuming 0.
also tried
[V,info]=ReadData3D('abc.mha');
but getting as : could not open file abc.mha
Is there any other method for analysis of .mha files
rohith bharadwaj
2018 年 1 月 14 日
I tried [V,info]=ReadData3D I got data in V and info
V is of order 240x240x155
and info is of 1x1
Now how to proceed further. how to plot V, convert this data into different layers(2D IMAGE by slicing)
Jan
2018 年 1 月 14 日
@rohith: Please be so kind and explain, which function you are using. "readdata3d" is not a built-in function. If you use a 3rd party tool, the readers have to know this.
The message "could not open file abc.mha" might mean, that there is no file with this name in the current folder. Perhaps you have to specify the complete path?
If you get your V as [240 x 240 x 155] array, you get the k.th slice by V(:, :, k).
rohith bharadwaj
2018 年 1 月 14 日
I don't know much about the function. but this line of code is not working every time. Is there any similar function in matlab to get similar output. readdata3d enables us to use .mha files. Is there another method to handle these extension files in matlab
Image Analyst
2018 年 1 月 14 日
ReadData3D is not a built-in function. Contact whomever gave you the .mha files and ask them if they have a reader for their files that works.
Jan
2018 年 1 月 14 日
@rohith: While you do not know much about the function, I do not know anything about it. I asked twice already for an explanation where you got this function from. Unfortunately you do not reveal this important detail. How could we know, if there is another tool, if you do not tell us, which tool you are using? How could we know a tool to get a similar output, without knowing to what it should be similar?
In addition your comments sound like you were able to import the file successfully already. So why are you looking for a different tool? I think your current problem is the plotting. Then please explain the details of what you want to plot how.
Image Analyst
2018 年 1 月 14 日
Here are 51 posts about mha files: https://www.mathworks.com/support/search_results.html?q=mha&submitsearch= I'm sure you can find something that works within those posts.
If a given mha reader only works for some files, then perhaps your reader and files don't match up as far as "flavors" of mha files that they work with. Try a different reader or make sure that your mha file is created with all the information that your reader expects to find.
rohith bharadwaj
2018 年 1 月 15 日
sir can you share your email id so that I can share my codes and explain my work in detail
thank you
Walter Roberson
2018 年 1 月 15 日
Image Analyst does not provide his email address for these purposes.
Walter Roberson
2018 年 1 月 15 日
RescaleSlope not available, assuming 1
RescaleIntercept not available, assuming 0.
Those are not errors. Dicom images have properties by those names that are used to make it practical to store floating point values as linear integer values instead, and the messages are just telling you that the data file you were reading does not make those properties available and will be interpreted "as-is". These properties mostly make a difference for CT images; you probably do not care about them.
Walter Roberson
2018 年 1 月 15 日
It is not up to me to provide the email address for Image Analyst. I know from past discussions that he does not email for these purpose: he would neither send nor receive email on these topics.
rohith bharadwaj should post the link to the ReadData3D that they are using, and if permitted, should attach the mha file (it would be necessary to zip it.)
Rik
2018 年 1 月 15 日
Sorry for the misunderstanding. I meant that rohith bharadwaj could just post the text of his e-mail here, instead of sending it to only Image Analist. If he is allowed to share it by e-mail, he should be allowed to post it here.
rohith bharadwaj
2018 年 1 月 15 日
Sir here is the data attached of brain mri scan. It's in mha format and is a 3d Image. We have to convert this 3d into a 2d image and use watershed algorithm to detect the tumor in the brain
rohith bharadwaj
2018 年 1 月 15 日
編集済み: Walter Roberson
2018 年 1 月 16 日
I've used the following code:
[V,info]=ReadData3D
for slice = 1 : numberOfSlices
thisSlice = V(:,:, slice);
baseFileName = sprintf('Slice %d.png', slice);
fullFileName = fullfile('F:\final yr project', baseFileName);
imwrite(thisSlice, fullFileName);
end
rohith bharadwaj
2018 年 1 月 15 日
The image should be gray scale analysed. So how to use these mha files to covert the 3d to above mentioned like pic. For further analysis using watershed
rohith bharadwaj
2018 年 1 月 15 日
Can you please suggest me how this can be done and also can you please provide me with the code if possible
Jan
2018 年 1 月 15 日
@rohit: I do not see attached data. You still keep it as a secret, which "ReadData3D" function you use and you simply ignore my corresponding questions. This is a strange behavior if you ask for assistance.
It is not clear what you are asking for now. Does the posted code work? It is not possible to post useful code based only on the description: "further analysis using watershed".
Please read and consider the link Rik has suggested 18 comments before: https://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer . Your current way of asking does not allow to help you and therefore this wastes your time only. The members of the forum really do like to help you, but give them a chance to do this.
rohith bharadwaj
2018 年 1 月 15 日
Sir I wanted to post the data. But it is in mha format. Hence the file isn't uploading. Could you give any mail id so that I can send you the data
rohith bharadwaj
2018 年 1 月 15 日
編集済み: rohith bharadwaj
2018 年 1 月 16 日
I want to use
baseFileName = 'bac.mha';
fullFileName = fullfile('F:', baseFileName)
I am getting these errors
Error using imread (line 350) Unable to determine the file format. Error in brainana (line 34) grayImage = imread(fullFileName);
Im getting black white images when took one image. but i have to do my analysis on grayscale image. the mha data should be converted to 2D similar to image attached above.
Image Analyst
2018 年 1 月 16 日
Come on rohith, you need to think a little before you do things. Now you know that imread() does not work with .mha files and your ReadData3D() function does work with them - you've already told us that. So why didn't you change from imread() to ReadData3D() in the demo???
rohith bharadwaj
2018 年 1 月 16 日
編集済み: rohith bharadwaj
2018 年 1 月 16 日
You are not getting my point. ReadData3D is giving 240x240x155 matrix. Ive sliced that to form a 2D image. but the image is in black and white(Slice 80.png attached). I dont want that image. I want greyscale image shown above for analysis. Its not compulsory to use ReadData3D. if there is any other better or easy way of approach Please let me know. I just want to convert that 3d to 2d grayscale images. After that i'll use watershed to detect tumour
Image Analyst
2018 年 1 月 16 日
How do you want to convert it? Take the mean along the slice direction? Take the maximum intensity projection? Take just one slice? I have no idea.
採用された回答
Walter Roberson
2018 年 1 月 16 日
Your data is not black and white. It is, however, in CT units, with values from 0 to 1509. To make visual sense out of that you need to rescale it. Use this:
V = mat2gray(V);
after you read the data in. That will scale the values in the array so that the maximum value is 1 and the minimum is 0. You can then extract slices and imshow() or image() them.
13 件のコメント
rohith bharadwaj
2018 年 1 月 16 日
Yes Thank you I got my 2d grayscale image.
Is there any watershed algorithm to find the tumour.
Walter Roberson
2018 年 1 月 16 日
"L = watershed(A) returns a label matrix L that identifies the watershed regions of the input matrix A, which can have any dimension"
Dileep Kumar Kothamasu
2018 年 3 月 12 日
I used the same code as mentioned above and I got 176 slices. so which slice can be used for preprocessing and segmentation. Or should we use whole 176 slices for preprocessing and segmentation if so how to do it.please attach the code if available or comment the solution
Walter Roberson
2018 年 3 月 12 日
Any slice that has content can be used for preprocessing and segmentation. Some slices will not happen to have the feature you are interested in, but you need to do pre-processing and segmentation in order to figure out what the slice does have.
Dileep Kumar Kothamasu
2018 年 3 月 12 日
I didn't get you. Can you briefly describe that? Do you mean we have to consider all the slices?
Walter Roberson
2018 年 3 月 12 日
When you look at any given slice, how do you know whether it contains whatever it is you are looking for?
Dileep Kumar Kothamasu
2018 年 3 月 13 日
編集済み: Dileep Kumar Kothamasu
2018 年 3 月 13 日
Ya That's what my doubt is to so how can I know which slice can be used? suppose in one image slice no. 80 looks fine and in another image slice no. 96 looks good so should I use slice no's 80 and 96 for preprocessing and segemtation and I am not sure about 80 and 96 slices are good because 80,81,82 slices are good with small variations in brain size so I confused can you help me in this?
Image Analyst
2018 年 3 月 13 日
Yes, you can use the whole 3-D volumetric image (all slices stacked together). That's what "which can have any dimension" means - 3-D as well as 2-D images are allowed.
Dileep Kumar Kothamasu
2018 年 3 月 15 日
Thank You, So how can I take whole slices stacked together go for further process
Dileep Kumar Kothamasu
2018 年 3 月 17 日
Walter code helped me to rescale them only.I don't know which slice I have to get feature extraction technique. Please help me. I got stuck on this problem and didn't move forward!!
Walter Roberson
2018 年 3 月 17 日
The researchers I worked with generally normalized the brain images, and then after that trained on a bunch of normal brains and a bunch with tumors. They did not use segmentation and preprocessing that I recall. But it has been over 15 years since I did any brain related work, and I was not much involved with the brain analysis theory (I was more responsible for interface and graphics and general program structure for the brain work.)
Image Analyst
2018 年 3 月 17 日
Because of your ambiguous posts, we don't know if you want to segment the 3-D volume, or if you want to segment out a 2-D region in just one slice. Why don't you start your own question, rather than keep bugging rohith, and post some of your slice images? click here
その他の回答 (1 件)
Image Analyst
2018 年 1 月 15 日
It looks like you got the mha reading part working so now you just need to find the tumor. Assuming it's bright, just threshold and call regionprops. It works in 2-D or 3-D. See attached demo.
参考
カテゴリ
Help Center および File Exchange で 3-D Volumetric Image Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)