Aswendt-Lab / AIDAqc

An automated and simple tool for fast quality analysis of animal MRI
GNU General Public License v3.0
3 stars 3 forks source link

use open source fonts for plotting #18

Open grandjeanlab opened 1 month ago

grandjeanlab commented 1 month ago

Describe the bug when using ParsingData.py on linux, i get.

PLOTTING QUALITY FEATURES... findfont: Font family 'Times New Roman' not found.

I think this is because this font is not available.

To Reproduce Steps to reproduce the behavior:

conda create -n aidaqc python=3.7 pip conda activate

git clone https://github.com/Aswendt-Lab/AIDAqc.git cd AIDAqc/ pip install -r requirements.txt

cd scripts/ chmod +x *.py ./ParsingData.py -i /project/4180000.36/aidaqc/bids -o project/4180000.36/aidaqc/test -f nifti

Expected behavior I expect files to be generated in QCfigures. I don't get any. other files are there.

test/ |-- QCfigures |-- caculated_features_anat.csv |-- caculated_features_func.csv |-- manual_slice_inspection | |-- anat_anat_sub-0100100_ses-1_T2w_1.png | |-- anat_anat_sub-0100101_ses-1_T2w_2.png | |-- anat_anat_sub-0100102_ses-1_T2w_3.png | |-- anat_anat_sub-0100103_ses-1_T2w_4.png | |-- func_func_sub-0100100_ses-1_run-1_bold_1.png | |-- func_func_sub-0100101_ses-1_run-1_bold_2.png | |-- func_func_sub-0100102_ses-1_run-1_bold_3.png | -- func_func_sub-0100103_ses-1_run-1_bold_4.png |-- nifti_data_addreses_anat.csv -- nifti_data_addreses_func.csv

Screenshots na

Desktop (please complete the following information):

Additional context times new roman is not a foss font, and it is not (easily) available on linux. i looked into different solutions (e.g. https://anaconda.org/conda-forge/mscorefonts and installing ttf-mscorefonts-installer in a container, but it did not work)

I think it is set there https://github.com/Aswendt-Lab/AIDAqc/blob/9f54a867f0495ac3d1ae4cdbd65f277a3f0b3b6b/scripts/QC.py#L468

grandjeanlab commented 1 month ago

i get this error in my container, which also suggest it is not just the use of times new roman, but that size is defined twice

  File "/usr/local/bin/ParsingData.py", line 306, in <module>
    QC.QCPlot(saving_path)
  File "/usr/local/bin/QC.py", line 522, in QCPlot
    plt.suptitle(N + ': ' + C, fontdict=title_font)
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/pyplot.py", line 2789, in suptitle
    return gcf().suptitle(t, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/figure.py", line 328, in suptitle
    return self._suplabels(t, info, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/figure.py", line 314, in _suplabels
    suplab = self.text(x, y, t, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/figure.py", line 1126, in text
    text = Text(x=x, y=y, text=s, **effective_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/text.py", line 155, in __init__
    self.update(kwargs)
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/text.py", line 197, in update
    kwargs = cbook.normalize_kwargs(kwargs, Text)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/matplotlib/cbook.py", line 1843, in normalize_kwargs
    raise TypeError(f"Got both {canonical_to_seen[canonical]!r} and "
TypeError: Got both 'size' and 'fontsize', which are aliases of one another