taznux / lung-image-analysis

A basic framework for pulmonary nodule detection and characterization in CT
https://qradiomics.wordpress.com/portfolio/lung-image-analysis-framwork/
MIT License
32 stars 15 forks source link

Input issue + .sid issue #10

Closed Aneeshers closed 7 years ago

Aneeshers commented 7 years ago

@taznux Hi It's aneeshers again, So as you suggested last time, I switched to Matlab R2016a , although I get the same errors. First I get the error

Struct contents reference from a non-struct array object.

Error in main (line 207)
for sid = unique(nodule_detection_evaluation.sid)'
screen shot 2016-12-30 at 4 56 54 pm

So then I change for sid = unique(nodule_detection_evaluation.sid)' to for sid = unique(nodule_detection_evaluation)' Although I feel this is not the real issue, after I do this I get a running program, except it's using a different variable as an input rather than path_data = '/Users/aneeshmuppidi/Documents/LIDC-DRI/LIDC-IDRI-DICOM'; %dcm files directory I run the program with a regular input, and I just get an output of nodule_detection_summary = [] Then I input no file path, I get the same result. After I do more retracing of the code, I find that filename_input = [ct_img_path pid '_input.mat']; Is actually taking inputs from a dicomImage_input.mat for each number of dicom images, I believe the dicomNumber_input.mat is being generated from fn_scan_pid.m Also I noticed that the filename_input = [ct_img_path pid '_input.mat']; is looking for a Dicomimage_input.mat from ct_img_path which is actually Output/CT_Images Which I'm kind of confused. So far that is my belief about this, I'm still confused, hopefully you can help me.

Thank you, Aneeshers.

Aneeshers commented 7 years ago

@taznux Also just wondering if I could se an example of your path, and If I could see what is inside of your _input.mat

taznux commented 7 years ago

I think you have wrong path or wrong data. Because there is nothing in your workspace. Your DICOM data folder has to be like this. image In this case, I can change the path like this. path_data = ['c:/Users/choiw/Documents/LIDC-IDRI']

If you don't have the correct dataset, you have to download it from the following link. https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI

Aneeshers commented 7 years ago

@taznux Hey, So Does each of the folder(ex. LIDC-IDRI-0271) have dicom files directly within the file, or is it within other file structures?

taznux commented 7 years ago

For example, LIDC-IDRI-0271 is a patient folder. There will be study folders inside of this and there will be another folder for series in the study folder. This is general structure of DICOM. Patient-Study-Series image If you have some DICOM files from another source, it is too difficult to run this code. So you have to download LIDC data.

Aneeshers commented 7 years ago

Yea my directory is also very similar, I inputted path_data = ['/Users/aneeshmuppidi/Documents/LIDC-DRI/LIDC-IDRI']; %dcm files directory Which looks like this

screen shot 2016-12-30 at 5 58 22 pm screen shot 2016-12-30 at 5 58 31 pm screen shot 2016-12-30 at 5 58 39 pm screen shot 2016-12-30 at 5 58 44 pm

Yet I still get the same output, it runs and outputs immediately nodule_detection_summary = [] I'm figuring out the filename_input = [ct_img_path pid '_input.mat']; part, can I see you Output_data/CT_IMages/ directory ?

taznux commented 7 years ago

Is this correct? Please check this. path_data = ['/Users/aneeshmuppidi/Documents/LIDC-DRI/LIDC-IDRI']; %dcm files You have correct dataset but still not working that means your path is incorrect or there is a typo. If your data path is correct output data will be generated.

You can type this 'ls /Users/aneeshmuppidi/Documents/LIDC-DRI/LIDC-IDRI' on your terminal. If the path is correct, you can see the list of patient directories. If not, there will be an error message.

Before run this, please remove the output directory 'output_data'. I think that is another reason why you have error at running this.

Aneeshers commented 7 years ago

@taznux Yes, my path is correct and when I ls into it I see LIDC-IDRI-LIDC-IDRI-0001 LIDC-IDRI-0002 etc... And Yes I ran the project without the output_data folder.

taznux commented 7 years ago

I think this code generate wrong data file when you have incorrect path. Next time you run this even you have correct path, my code reload wrong information. So, you may delete 'dicom_pid_list.mat' in the output diretory or change this part

%% get pids
filename_pid_list = [path_nodule '/dicom_pid_list.mat'];
if(fn_check_load_data(filename_pid_list, load_input))
    [dicom_path_list,pid_list]=fn_scan_pid(path_data);

    save(filename_pid_list, 'dicom_path_list', 'pid_list');
else
    load(filename_pid_list);
end

to

%% get pids
 [dicom_path_list,pid_list]=fn_scan_pid(path_data);
Aneeshers commented 7 years ago

@taznux Thank you, Now the code seems to be recognizing the LIDC data and established the dicom tags, however is looks like I got another error......

So I inputted the code I get good results, I get

1 LIDC-IDRI-0002
dicom images loaded ...               37.34 sec
interpolation completed ...               58.52 sec

Which is a great output after trying to get the code to work, Then I get an error for the segmentation call

Not enough input arguments.

Error in fn_lung_segmentation (line 80)
    corrected_s = fn_remove_critical_section(s, 30*pixelsize(1)); %% critical
    section

Error in main (line 122)
        [lung_seg_img_3d,T]=fn_lung_segmentation(interpol_lung_img_3d);

Hopefully there is another easy fix for this? :) Thank you for your time, Aneeshers

taznux commented 7 years ago

That's great!

I found a bug at calling lung segmentation. Sorry about it. This code will work well. [lung_seg_img_3d,T]=fn_lung_segmentation(interpol_lung_img_3d,thick,pixelsize);

This is what you will see after modifying the lung segmentation call. I'm going to commit this fix soon.

1 LIDC-IDRI-0001 dicom images loaded ... 0.95 sec interpolation completed ... 2.13 sec segmentation completed ... 20.22 sec nodule candidate detection completed ... 41.41 sec nodule feature extreaction completed ... 41.76 sec

pt =

      pid           sid    tpr
________________    ___    ___

'LIDC-IDRI-0001'    '1'    1  
'LIDC-IDRI-0001'    '2'    1  
'LIDC-IDRI-0001'    '3'    1  
'LIDC-IDRI-0001'    '4'    1  
'LIDC-IDRI-0001'    'a'    1  

nodule candidate detection completed ... 42.25 sec 2 LIDC-IDRI-0002 dicom images loaded ... 33.50 sec interpolation completed ... 47.06 sec segmentation completed ... 62.08 sec nodule candidate detection completed ... 82.04 sec nodule feature extreaction completed ... 82.24 sec

pt =

      pid           sid    tpr
________________    ___    ___

'LIDC-IDRI-0002'    '3'    1  
'LIDC-IDRI-0002'    '4'    1  
'LIDC-IDRI-0002'    'a'    1  

nodule candidate detection completed ... 82.36 sec 3 LIDC-IDRI-0003 dicom images loaded ... 17.23 sec interpolation completed ... 31.46 sec segmentation completed ... 49.78 sec nodule candidate detection completed ... 79.60 sec nodule feature extreaction completed ... 79.94 sec

pt =

      pid           sid    tpr
________________    ___    ___

'LIDC-IDRI-0003'    '1'    1  
'LIDC-IDRI-0003'    '2'    1  
'LIDC-IDRI-0003'    '3'    1  
'LIDC-IDRI-0003'    '4'    1  
'LIDC-IDRI-0003'    'a'    1  

nodule candidate detection completed ... 80.17 sec 4 LIDC-IDRI-0004 dicom images loaded ... 24.11 sec interpolation completed ... 38.99 sec segmentation completed ... 55.63 sec nodule candidate detection completed ... 80.42 sec nodule feature extreaction completed ... 80.71 sec

pt =

      pid           sid    tpr
________________    ___    ___

'LIDC-IDRI-0004'    '1'    1  
'LIDC-IDRI-0004'    '2'    1  
'LIDC-IDRI-0004'    '3'    1  
'LIDC-IDRI-0004'    '4'    1  
'LIDC-IDRI-0004'    'a'    1  

nodule candidate detection completed ... 80.80 sec 5 LIDC-IDRI-0005 dicom images loaded ... 16.52 sec interpolation completed ... 26.35 sec segmentation completed ... 39.45 sec nodule candidate detection completed ... 59.66 sec nodule feature extreaction completed ... 59.93 sec

pt =

      pid           sid      tpr  
________________    ___    _______

'LIDC-IDRI-0005'    '1'    0.66667
'LIDC-IDRI-0005'    '2'          1
'LIDC-IDRI-0005'    '3'          1
'LIDC-IDRI-0005'    '4'          1
'LIDC-IDRI-0005'    'a'    0.91667

nodule candidate detection completed ... 60.06 sec

nodule_detection_summary =

sid      tpr  
___    _______

'1'    0.91667
'2'          1
'3'          1
'4'          1
'a'    0.98333