matlab code for liver segmentation

13 ビュー (過去 30 日間)
Manjunath R V
Manjunath R V 2020 年 9 月 4 日
コメント済み: Manjunath R V 2020 年 12 月 11 日
Hello evryone can anybody share the matlab code for liver segmentation on CT images.
so that it is very useful to my research
  7 件のコメント
Image Analyst
Image Analyst 2020 年 12 月 6 日
Did you try my solution below? If my simplistic code below in my Answer didn't work for you, then you can try the more sophisticated methods here:
For example, this one looks promising:
Comparison and Evaluation of Methods for Liver Segmentation From CT Datasets,
MedImg(28), No. 8, August 2009, pp. 1251-1265.
Manjunath R V
Manjunath R V 2020 年 12 月 6 日
@image analyst need to try what u provided i will update once i complete that
i have went through number of papers related to liver segmentation but what exactly i need now is dataset of CT images and liver segmentation matlab code

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

回答 (3 件)

Image Analyst
Image Analyst 2020 年 12 月 6 日
See attached demos for finding tumors and skulls. Adapt as needed.
Also see my Image Segmentation Tutorial in my file Exchange
  6 件のコメント
Rik
Rik 2020 年 12 月 10 日
If it didn't, post your code and your image.
Image Analyst
Image Analyst 2020 年 12 月 10 日
We don't have "a "dataset of CT images" so you're on your own for that. Surely your project sponsor has some images. I mean, why else would they hire you to do this project if they didn't have any images?
Secondly you said you read several papers that discussed liver segmentation in the link I gave you. There are hundreds of papers there and I don't have the code for any of them. I imagine that you did what I would have done, and that is to contact the authors and see if there is a way you can obtain their code (like buy it). Assuming you did that and either did not get a response, or the response was that they are not willing to help you, then you're left to write it on your own based on whatever paper you thought was best. Or you could invent your own new and improved method. But again, there is no Liver Segmentation Toolbox in MATLAB, and none of us volunteers have any code for that. If you want, the Mathworks would be delighted to write it for you. Just click on the "Consulting" link on their home page.

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


Manjunath R V
Manjunath R V 2020 年 12 月 11 日
Hello sir this is the Unet code am using to train the 256x256 size CT images.
when i tested the code after training, output image will be same as that of input image. it is unable to segment the liver from the CT image. Here am attaching the code as well as an input and output image please do the needfull.
clc
clear all
close all
load gTruth.mat
% currentPathPixels = "C:\RVM\code_with_image_labl\Unet\PixelLabelData";
% newPathPixels = fullfile('C:\RVM\code_with_image_labl\Unet\liverPixelLabels');
% alternativePaths = {[currentPathPixels newPathPixels]};
% unresolvedPaths = changeFilePaths(gTruth,alternativePaths)
% Load training images and pixel labels into the workspace.
dataSetDir = fullfile('C:\RVM\code_with_image_labl\Unet'); %%Change the the path before run the code
imDir = fullfile(dataSetDir,'Inp_256');
pxDir = fullfile(dataSetDir,'lab256');
% Create an imageDatastore object to store the training images.
Original_imageData = imageDatastore(imDir);
% Define the class names and their associated label IData_set.
classNames = ["background","Abdomen","Liver"];
labelIData_set = [0 1 2];
% labelIData_set = cell(3,1);
% labelIData_set{1,1} = [2;0];
% labelIData_set{2,1} = 1;
% labelIData_set{3,1} = 3;
% Create a pixelLabelDatastore object to store the ground truth pixel labels for the training images.
Segmented_imageData = pixelLabelDatastore(pxDir,classNames,labelIData_set);
% Create the U-Net network.
imageSize = [256 256 1];
numClasses = 3;
Unet_Strct = unetStracture(imageSize, numClasses);
% Create a datastore for training the network for training a semantic segmentation network using deep learning
Data_set = pixelLabelImageDatastore(Original_imageData,Segmented_imageData);
% Set training options.
% % options = trainingOptions('sgdm', ...
% % 'InitialLearnRate',1e-3, ...
% % 'MaxEpochs',10, ...
% % 'VerboseFrequency',10);
options = trainingOptions('sgdm', ...
'Momentum',0.9, ...
'InitialLearnRate',8e-4, ...
'L2Regularization',0.0005, ...
'MaxEpochs',50, ...
'MiniBatchSize',3, ...
'Shuffle','every-epoch', ...
'CheckpointPath', tempdir, ...
'VerboseFrequency',2, ...
'Plots','training-progress');
% Train the network.
newcode_net = trainNetwork(Data_set,Unet_Strct,options)
%Trained data will be saved
save newcode_net newcode_net;

Manjunath R V
Manjunath R V 2020 年 12 月 11 日
in the above code if i add encoder depth in the Unet_Strct line like as mentioned below
Unet_Strct = unetStracture(imageSize, numClasses,Encoder depth,'1');
it is segmenting the liver but still improvement is required for reference am attaching input and output images moreover here
it is displaying 22 layers but i want 53 layers unet so needed clarification on this also.
any information provided related to the above is appreciable
  2 件のコメント
Rik
Rik 2020 年 12 月 11 日
Neither of these answers are actually answers. Please post them as comments in the appropriate section. Please also use the formatting tools to make your code more readable.
Manjunath R V
Manjunath R V 2020 年 12 月 11 日
thank you for u r suggestion sir

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

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by