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

Data preprocessing for CHAOS dataset can break. #3

Closed
patmjen opened this issue Jan 22, 2021 · 5 comments
Closed

Data preprocessing for CHAOS dataset can break. #3

patmjen opened this issue Jan 22, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@patmjen
Copy link

patmjen commented Jan 22, 2021

First, thanks a lot for releasing the code!

During preprocessing of the CHAOS dataset, the xy-slices may get loaded out-of-order since os.listdir does not necessarily sort the file names. Specifically, L104 and L152 in data/chaos.py:

images_path = [dir for dir in os.listdir('{}/{}/DICOM_anon'.format(data_root, sample)) if 'dcm' in dir]

images_path = [dir for dir in os.listdir('{}/{}/Ground'.format(data_root, sample)) if 'png' in dir]

This messes up the data since the xy-slices are then in the wrong order. Calling sorted on images_path seems to fix it.

@udaranga3001
Copy link
Collaborator

udaranga3001 commented Jan 25, 2021

I agree that this can cause an issue. Thank you for pointing it out. I will update the code.

In our experiments, it didn't cause any problems. If it did, we would have noticed it since we save image volumes and ground truth volumes in the experiments.

@udaranga3001 udaranga3001 added the enhancement New feature or request label Jan 25, 2021
@patmjen
Copy link
Author

patmjen commented Jan 25, 2021

Great, thank you!
Just to be clear, the reason for my issue was that I did run the code and had this exact issue.

@Polaris112027
Copy link

So, the solution to this problem is still not updated in the code. Can you post the exact code for your solution? I also encountered this problem

@patmjen
Copy link
Author

patmjen commented Jan 20, 2023

Sure, I changed it to

images_path = [dir for dir in os.listdir('{}/{}/DICOM_anon'.format(data_root, sample)) if 'dcm' in dir]
images_path = sorted(images_path)

at L104, and

images_path = [dir for dir in os.listdir('{}/{}/DICOM_anon'.format(data_root, sample)) if 'png' in dir]
images_path = sorted(images_path)

at L152.

This sorts the images by name, which puts them in the correct order.

@Polaris112027
Copy link

I run the code but meet the error:No such file or directory: '/content/drive/My Drive/voxel2mesh/Chaos/Train_Sets/DICOM_anon' . I checked the path but found that the correct format of path should be like "voxel2mesh/Chaos/Train_Sets/CT(or MR)/1(or 2,3,4...)/DICOM_anon" .Have you ever met the same error?Do you have any suggestion to deal with this error?

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

No branches or pull requests

3 participants