ccipd / MRQy

RadQy is a quality assurance and checking tool for quantitative assessment of magnetic resonance imaging (MRI) and computed tomography (CT) data.
https://ccipd.github.io/MRQy/
BSD 3-Clause Clear License
94 stars 28 forks source link

File exists error when saving the thumbnails #19

Closed giemmecci closed 2 years ago

giemmecci commented 2 years ago

Hi, I'm testing this tool in a folder structure organized as follows:

.
├── ID1
│   ├── CT1.nii
│   └── FLAIR.nii
└── ID2
    ├── CT1.nii
    └── FLAIR.nii

And I'm getting this error:

Traceback (most recent call last):
  File "QC.py", line 359, in <module>
    saveThumbnails_nondicom(v,fname_outdir)
  File "QC.py", line 181, in saveThumbnails_nondicom
    os.makedirs(output + os.sep + v[1])
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/Users/censored/mrqy/MRQy/src/mrqy/UserInterface/Data/Jun24test/CT1'

I believe the issue is that when saving the thumbnails, these are stored in a single, flat folder that doesn't follow the original tree structure, so the program finds that the "CT1" folder already exists:

.
├── CT1
│   ├── CT1(1).png
│   ├── CT1(10).png
│   ├── CT1(11).png
│   ├── CT1(12).png
│   ├── CT1(13).png
│   ├── CT1(14).png
│   ├── CT1(15).png
│   ├── CT1(16).png
│   ├── CT1(17).png
│   ├── CT1(18).png
│   ├── CT1(19).png
│   ├── CT1(2).png
│   ├── CT1(20).png
│   ├── CT1(21).png
│   ├── CT1(22).png
│   ├── CT1(23).png
│   ├── CT1(24).png
│   ├── CT1(25).png
│   ├── CT1(26).png
│   ├── CT1(27).png
│   ├── CT1(28).png
│   ├── CT1(29).png
│   ├── CT1(3).png
│   ├── CT1(4).png
│   ├── CT1(5).png
│   ├── CT1(6).png
│   ├── CT1(7).png
│   ├── CT1(8).png
│   └── CT1(9).png
├── FLAIR
│   ├── FLAIR(1).png
│   ├── FLAIR(10).png
│   ├── FLAIR(11).png
│   ├── FLAIR(12).png
│   ├── FLAIR(13).png
│   ├── FLAIR(14).png
│   ├── FLAIR(15).png
│   ├── FLAIR(16).png
│   ├── FLAIR(17).png
│   ├── FLAIR(18).png
│   ├── FLAIR(19).png
│   ├── FLAIR(2).png
│   ├── FLAIR(20).png
│   ├── FLAIR(21).png
│   ├── FLAIR(22).png
│   ├── FLAIR(23).png
│   ├── FLAIR(24).png
│   ├── FLAIR(25).png
│   ├── FLAIR(26).png
│   ├── FLAIR(27).png
│   ├── FLAIR(28).png
│   ├── FLAIR(29).png
│   ├── FLAIR(3).png
│   ├── FLAIR(4).png
│   ├── FLAIR(5).png
│   ├── FLAIR(6).png
│   ├── FLAIR(7).png
│   ├── FLAIR(8).png
│   └── FLAIR(9).png
└── results.tsv

Did you ever run into this issue? And, in general, what tree structure MRQy expects to work correctly? Is there an option to avoid saving the thumbnails?

Also, as a minor comment, the first lines in the output in this case reads:

MRQy is starting....
The number of patients is 4

But in reality, the number of patients is 2, while 4 is the number of series.

Thanks!

satishev commented 2 years ago

Looping in @Amir-Reza-Sadri.

Amir-Reza-Sadri commented 2 years ago

Better would be to put each file type in one folder separately. To avoid saving the thumbnails comment the line#359 of the QC.py code (considering you are using the .nii files)