Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading registration data link is broken #1

Open
tomishninja opened this issue Feb 7, 2020 · 16 comments
Open

Downloading registration data link is broken #1

tomishninja opened this issue Feb 7, 2020 · 16 comments

Comments

@tomishninja
Copy link

Hi,

The link for your registration data seems to be down. If it's possible, could I get access to this data set so I can run your network and get a better idea of how the data should be laid out?

The broken link below:
https://www.slicer.org/w/images/e/eb/RegistrationData.zip

I understand that the data might not be allowed for open use so if it isn't please let me know who I should talk to about getting a copy of it.

Regards,
Tom

@Josemi13
Copy link

Hi,

I would like to understand how I could use my data set. I have thought it's possible to obtain a copy of your data set and I can see the CNN is working. I don't understand which directories and parameters I have to put in the yaml.

Regards,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Jan 19, 2021 via email

@Jomigi Jomigi closed this as completed Jan 19, 2021
@Jomigi Jomigi reopened this Jan 19, 2021
@Josemi13
Copy link

Josemi13 commented Jan 22, 2021

Hi,

First of all, thanks for your answer.

I have 5 CT Scans of differents patients (2D slides of axial cut). I have segmented the CT Scans with 3DSlices software to separate bone and background (air or other structures) using thresholding method. For examples, I decide to use 3 Scans for training and 2 for test. Both slides (original and segmented) are in nrrd format.

So, the input in the CNN will be (if I have understand it):

  • The 3 CT Scans of training (2d slides of axial cut) are stored in trn_CT_dir
  • The 2 CT Scans of testing (2d slides of axial cut) are stored in tst_image_dir
  • The 3 segmented CT Scans of training with thresholding method (result of executing 3dSlicer) are stored in thr_label_dir

Is it correct?

I don't understand the different between thr_label_dir and trn_label_slice_dir. The segmented slices with the thresholding method are the final result I want to obtain. Instead of using the 3dSlicer, I will use the CNN to segment other CT Scans.

I look forward to hearing from you.

Best,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Jan 25, 2021

All 5 CT scans that you have should be stored as 3D volumes, not as separate 2D slices. So, a single .NRRD file is used for an entire 3D scan. You are right about settings the paths; those are correct.

The difference between thr_label_dir and trn_label_slice_dir, is that thr_label_dir is the directory that holds the segmentation labels of the 3D CT scans segmented with thresholding. thr_label_slice_dir is in principle empty, and will be used by the code to generate the 2D slices from the thresholded 3D CT that were given in thr_label_dir. I hope this clarifies it.

Jordi

@Josemi13
Copy link

Josemi13 commented Jan 26, 2021

Hi,

Thanks for the description.

So I have to store 3D CT scans segmented (the target of the CNN) in trn_label_slice_dir and leave thr_label_dir empty, isn't I?

Related of the CT Scan, I only have images of axial cut. Is possible to convert these images in 3D volumes? Or I need a full CT Scan (images of all cut). Is 3D volumes the labelmaps that are created in the 3DSlicer?

I look forward to hearing from you.

Best,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Feb 17, 2021

Hi,

Sorry for the delay. thr_label_dir should not be empty. It should contain a segmented 3D scan (in principle using thresholding). This is only used as a comparison to the CNN. trn_slice_slice_dir should indeed be empty.

Concerning the error messages you get: can you check if slices have been stored in the trn_slice_label_dir and trn_slice_dir? The error seems to suggest that no slices are available to create the patches.

@Josemi13
Copy link

Hi,

The trn_slice_label_dir, trn_label_slice_PNG_dir, trn_label_slice_NPY_dir folders store images. The problem is the thr_label_slice_PNG_dir folder doesn't save the images. I am storing a labelmap with format .nrrd (it is result of applying thresholding over the CT_Scan in the 3D Slicer software) in thr_label_dir. I don't understand why I don`t obtain png images of the labelmap.

I look forward to hearing from you.

Best,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Feb 18, 2021

Hmm I see. Are the thresholded slices not saved for a single patient, or for all of them? The code should be produces slices based on the thresholded CT scans.

It sounds like a problem with the path names. Can you check that your path is correct, and that it also ends with a '/'. The code assumes that the path name ends with an '/' (e.g., 'path/to/thr_slices/').

If this wasn't the problem, you may need to check if the .nrrd files are correctly loaded (line 116 in PatientIO.py). The object threshold_slices should be a 3D matrix with the same size as the CT scan. Let me know

@Jomigi
Copy link
Collaborator

Jomigi commented Feb 27, 2021

Hi Josemi, sorry to hear about the problems you are experiencing. Unfortunately I don't have much time to keep this repo up-to-date, so I apologize for my late responses.

I think there are two separate problems. One is the creation of the threshold PNG slices, which does not work. The second problem is that the patches cannot be generated, which is the error that you see in picture 6. Since the threshold slices are not used to create patches, I don't expect that these problems are related.

About the creation of the threshold slices, I found a mistake in the configReader file. I just fixed the mistake and pushed the new code. If you pull this new code, it should create the threshold PNG files. Please let me know if this solves the issue.

Regarding error about the patch generation, can you check a few things for me?

  • What is the patch size you are trying the extract? This should be specified in config.yml
  • What are the exact voxel values of your gold standard labels? Are these {0,1} or something else? Sometimes Slicer exports the volumes in a range of {0,256}.

All the best,
Jordi

@Jomigi
Copy link
Collaborator

Jomigi commented Mar 1, 2021

Hi,

It seems like the thresholded slices are of a different data type than your gold standard label (not your fault, just someting 3DSlicer apparently does. To avoid the problem, I made a small adjustment to the code, which should convert your thresholded labelmaps into the correct data type. I hope this works.

Best,
Jordi

@Josemi13
Copy link

Josemi13 commented Mar 6, 2021

Hi,

Thanks, I can convert the thresholded labelmaps.

Regarding about error the patch generation, how could I check the exact voxel values of the gold standard labels?

I don't know what to do to fix the error.

Thanks for your colaboration and your time.

Best,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Mar 7, 2021

Hi,

Thank you for checking the values of the labels. Did you check all values of the thesholded slices? In the screenshot you showed only the upper left corner of the image, which is empty (there are no bony structures there). In any case, I don't think that the errors are caused by the thresholded slices.

The error you mentioned is generated when creating labels from the training scans. This has probably to do with the values of the labels of the training data. To test which values are used in the training labels, you can do the following:

In a new python console:

import numpy as np
img = np.load(path_to_label_slice_NPY) #replace the path with the path to your NPY of the training labels
np.unique(img)

Please let me know what the output of this is.

@Jomigi
Copy link
Collaborator

Jomigi commented Mar 9, 2021

Hi,

This maybe has to do with the fact that the overwrite function is turned off. This means that a numpy file won't be overwritten with a new one. You can turn the overwrite function on by adding the following statement when calling the function patient.read_save_labels in line 57 in deepy.py:

overwrite=True

@Josemi13
Copy link

Hi,

Sorry for insisting but I need to segment the images of the patients in few weeks. I have tried to many options but the error doesn't disapper.

Best,

Josemi

@Jomigi
Copy link
Collaborator

Jomigi commented Apr 12, 2021

Hi Josemi, sorry for not responding earlier. I have been very busy with a new job, finishing my PhD, and some other stuff, so I haven't been able to maintain this repo properly.

Anyway, seeing your code, it seems that segm only contains "2s". However, the code for the patch generation looks for values of "1" to determine a region of interest. Therefore, I would expect that Upper/Lower/Left/Right Edge cannot be found, which gives an error when trying to generate patches.

Do you have an idea of why segm only consists of 2s? It surprises me, because when you loaded trn_label_slice_NPY_dir/1_9.npy, the file seemed to consists of 0s and 1s.

Are you allowed to share your data? If so, maybe you can share it so I can try to reproduce the problem myself. If not, maybe we could set up a virtual meeting? I find it very difficult now to guess what the exact problem is.

@Jomigi
Copy link
Collaborator

Jomigi commented Apr 12, 2021

I mean the value 2. It seems that the segm array only consists of values equal to 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants