tomdoel / pulmonarytoolkit

Lung medical image analysis and visualisation software for Matlab.
GNU General Public License v3.0
84 stars 57 forks source link

can't do automatic lung segmention #19

Closed ghost closed 7 years ago

ghost commented 7 years ago

hello tomdoel,

your code looks nice and the lung segmentations using the GUI works well. But if I try to do some automatic segmentation, using your tutorial "TK - Tutorial 3.pdf" something is going wrong....

If I try:

file_infos = PTKDiskUtilities.GetListOfDicomFiles(source_path);

this error occures:

The class PTKDiskUtilities has no Constant property or Static method named 'GetListOfDicomFiles'.

The source_path includes mhd and raw files. do you have any advice? would be great!

Thanks

tomdoel commented 7 years ago

Hi kleinfeld,

Thanks for flagging this.

The tutorials are a bit out of date, so some class and function names have changed and they need to be updated.

It should be file_infos = PTKDicomUtilities.GetListOfDicomFiles(source_path);

This function will only work for DICOM files. For mhd files, the easiest thing to do is to import all the files and then reference them by the "unique" identifiers (uids) that are returned. You can import the files with uids = ptk_main.ImportData('path-to-your-files') which will give you a cell array of uids (strings), one for each image found in that directory. So uids{1} will be the uid for the first mhd file found, uids{2} the uuid for the second, etc. Then you can use ptk_main.CreateDatasetFromUid(uids{1}) to create a dataset from the first file, etc. The uid is ultimately what PTK uses to differentiate between series.

NB. As a side note, mhd files don't have any unique identifiers in the headers, so by default PTK just uses the first part of the filename as the uid (which is fine as long as you don't have two different mhd image series with the same name). But you can also define your own uids for PTK to use, by creating your own PTKImageInfo object and then using ptk_main.CreateDatasetFromInfo(), but that's not necessary for the purposes of this tutorial.

ghost commented 7 years ago

hello tomdoel,

thank you for your advices. I have fixed the problems for me.

I wanted to calculate the lungsegmentation of 888 CT scans. You can find them at the luna16 competition: (https://luna16.grand-challenge.org/)

Some of the CT Scans make little problems with your code, so I had to fix it for myself. It was a little bit nasty implemented by me, but works for me now ;-) Maybe if I have a little bit more time, I can report my problems in detail. But thanks for your nice implementation, was really helpful!!!

Do you have any paper/informations how your segmentation-algorithm works?

Thanks and greetings, kleinfeld

PS: Do you know this paper: https://www.degruyter.com/downloadpdf/j/cdbme.2016.2.issue-1/cdbme-2016-0114/cdbme-2016-0114.pdf

tomdoel commented 7 years ago

Hi,

Thanks for the link!

I've added a "Citations" page to the wiki, which includes some publications which describe how the algorithms work. Most are open access

I will close this issue now, as the tutorial is fixed.

Thanks, Tom

ehsanabadi commented 6 years ago

Hi Tom, Thanks again for your awesome toolkit!

Have you changed the class for importing the Dicom files? Previously, I was able to load my dicom images using PTKDiskUtilities.GetListOfDicomFiles, but it is not working anymore.

Thank you, Regards, Ehsan

tomdoel commented 5 years ago

Noting here that PTKDiskUtilities.GetListOfDicomFiles was removed but later re-added in v0.8 as a legacy function to support the tutorials and external users.