Git Product home page Git Product logo

Comments (6)

timjerman avatar timjerman commented on June 28, 2024

Hi Jun,

could you give me some more info about you problem:

  • For question 1, can you specify the input parameters, so that I can recreate the images
  • For question 2, do you first mask the liver out and then compute the enhancement response, or the other way around.

Regards,
Tim

from jermanenhancementfilter.

JunMa11 avatar JunMa11 commented on June 28, 2024

Hi @timjerman ,
Thanks for your soon reply.

  1. I upload the source code and data to google drive. You can download and run it directly to obtain the enhanced results.
    This is my input parameters.
EnVessel = vesselness3D(LiverVolume, 3:5, spacing, 0.1, true);
  1. The reverse is true. Firstly, I enhance the whole volume and then mask the liver out.

Please feel free to contact me if you need further information.

Best,
Jun Ma

from jermanenhancementfilter.

timjerman avatar timjerman commented on June 28, 2024

First, I would like to mention that enhancement of the liver vasculature is quite hard because of poor contrast between vessels and liver tissue and high noise. Therefore, usually it is required to do some preprocessing and postprocessing of the input and output image, respectively.

About your first question. The problem is that you compute the enhancement response for both spacings with the same sigmas (3:5):

EnVessel = vesselness3D(LiverVolume, 3:5, spacing, 0.1, true);

Sigma values and the spacing are connected. When spacing is [1 1 1] the enhancement is the same in all directions and the sigma values represent the size of the structures in voxels. On the other hand when spacing is set to the image spacing (in your case [0.6406 0.6406 1.5]) where the resolution is not the same in all directions, the sigma values are defined in millimeters and the image is enhanced differently between directions.
To get a comparable result different sigmas should be used, e.g.:

EnVessel_space = vesselness3D(LiverVolume, [3:5] .* 0.6406, [0.6406 0.6406 1.5], 0.1, true);
EnVessel_defaultspace = vesselness3D(LiverVolume, 3:5, [1 1 1], 0.1, true);

This should achieve a comparable enhancement if looking at the axial slices. The main difference should be visible in the z-direction. I expect a better enhancement in the z-direction if the image spacing is used and the right sigmas. Another possibility is to resample the image into an isotropic space, e.g. [0.6406 0.6406 0.6406] and then use the identity as spacing. To determine what works best for you, you should try different ways and see what yields better results.

Moreover, you set the value of tau to 0.1. I recommend that tau is set between 0.5 and 1, where a lower value yields better enhancement of the vasculature, however, there are also more false positives.

Nevertheless, for tau to work properly, the vessels need to have the highest intensity values in the image and there should be good contrast between the vessels and the background. Thus you need to preprocess the image that this is satisfied. In your example, there are bones that have way higher intensities than the vessels and there is poor contrast between vessels and liver tissue. Here masking can help. You should first mask and then enhance.

The liver borders (yellow arrows) are enhanced because, first, your sigmas (scales) are too high. The second reason is that there is a high contrast between the background and liver and such well defined walls sometimes can also be enhanced. Usually prepreocessing of the input image helps to reduce such responses.

To push you in the right direction I quickly drafted a preprocessing script for your case with some comments. The results are not yet ideal but it should be a good starting point. I will let you try achieving better results by modifying various parameters.

% The liver mask still contains some vertebrae and background, thus, I eroded your mask by 2 pixels.
erode_radii = 2;
[xx,yy,zz] = ndgrid(-erode_radii:erode_radii);
nhood = sqrt(xx.^2 + yy.^2 + zz.^2) <= erode_radii;
PV_liver_mask = imerode(PV_liver_mask,nhood);

% Then the input volume is masked to retain only the liver region.
LiverVolumePP = LiverVolume .* PV_liver_mask;

% Next, the contrast between the vessels and liver tissue is improved.
% For example, we remove all values bellow the 10th percentile
lower_thr = prctile(LiverVolume(PV_liver_mask(:)==1), 10);
LiverVolumePP = LiverVolumePP - lower_thr;
LiverVolumePP(LiverVolumePP < 0) = 0;

% Similarly we equalize the values of some remaining bones and vessels
upper_thr = prctile(LiverVolumePP(PV_liver_mask(:)==1),99.9);
LiverVolumePP(LiverVolumePP > upper_thr) = upper_thr;

% Now the vessels should have the highest values in the image and there should be a good contrast

% To remove the false detections at the liver borders we set the values outside the liver mask to the median of the values inside the liver.
% Here I am trying to remove the border of the liver so it can't be enhanced. This can probably be improved.
LiverVolumePP(PV_liver_mask(:)==0) = median(LiverVolumePP(PV_liver_mask(:)==1));

% In the end we just normalize the values (not really needed)
LiverVolumePP = LiverVolumePP / max(LiverVolumePP(:));

% Enhancement
EnVessel = vesselness3D(LiverVolumePP, [2 2.5], [1 1 1], 0.75, true);

The resulting enhancement should look like this. On the left is your input image (LiverVolume ), in the center is the prepreocessed image (LiverVolumePP), and finally on the right is the squared enhanced image (EnVessel.^2).

image

With such results, you could threshold the enhanced image, and then extract the largest connected components to retain the vasculature and remove some of the false positives.

Like I already said, I think, that the results can be additionally improved by tuning the enhancement parameters and the preprocessing (improvemet of contrast and reduction of liver-background and liver-tumor borders).

I hope that this will work well for you.

I have a question. Could I use your image and add it to this repository to use it as an example together with the code above?

Regards,
Tim

from jermanenhancementfilter.

JunMa11 avatar JunMa11 commented on June 28, 2024

Hi, Tim
Thanks for getting back to me so quickly! Sorry for my late response.
Your suggestions help me a lot and the results are really amazing.

For your question, I'd like to give you another public data. You can download it here.
This is because the new data has a more accurate segmentation.
I download it from the 3D-IRCADb and convert the dicom format into the Nifti format.

Thanks again for your help.
Best regards,
Jun Ma

from jermanenhancementfilter.

AbirA13 avatar AbirA13 commented on June 28, 2024

@timjerman @EdwardMa12593
Dear Tim,Edward
Firstly, thank you both for sharing this work and the code, i found it very useful for my project, the objectif of my work is to segment the liver into the eight different regions
proposed by Couinaud (1957), using the hepatic and portal veins position in the liver, and that's why i found your code very useful, please if you have any others paper that help me to release my work please can you send them with code please, because i need firstly to segment the vessels and the i'll try to idetify the different component of thus vessels (hepatic veins, portal one), to perform segmentation proposed by Couinaud.
Thanks for your help.
Best regards,

Abir AFFANE

from jermanenhancementfilter.

JunMa11 avatar JunMa11 commented on June 28, 2024

Hey, @AbirA13
I am also very interested in this task (segment the liver into different regions). However, I have not found any useful papers/codes. Do you have any suggestions?

Best regards,
Jun

from jermanenhancementfilter.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.