Plot

Synthesis Quality

synthqc.plot.synth_quality

create plot showing synthesis image quality

Author: Jacob Reinhold (jacob.reinhold@jhu.edu)

Created on: Jun 26, 2018

synthqc.plot.synth_quality.plot_synth_quality_bar(synth_dirs, truth_dirs, norm_algs, synth_algs, out_dir=None, mask_dir=None, outtype='png')

Generate a fairly specific plot pertaining to the three quality metrics and their relative performance given multiple different normalization and synthesis algorithms

There is probably not a good reason for a user (other than the author) to try to use this function

Parameters:
  • synth_dirs (list) – list of directories (strings) each containing N images corresponding to the N images in truth_dirs
  • truth_dirs (list) – list of directories containing the corresponing true images
  • norm_algs (list) – list of normalization algorithms under consideration (must equal number of directories under each synth_dir)
  • synth_algs (list) – synthesis algorithms under consideration (must equal number of directories provided in the synth_dirs argument)
  • out_dir (str) – directory in which to output the generated figure
  • mask_dir (str) – directory holding the masks for the images in each of the synth_dir and truth_dir
  • outtype (str) – output image type (e.g., pdf, png, etc.)
Returns:

pandas dataframe holding tabulated information regarding all

quality tests run in this function

Return type:

data (pd.DataFrame)

synthqc.plot.synth_quality.plot_dir_synth_quality(synth_dir, truth_dir, out_dir=None, mask_dir=None, outtype='png', mean=False)

compare directory of synthesized and truth (nifti) images by calculating correlation, mattes mutual information, and ssim and plotting a radar plot of the absolute value of those statistics

Parameters:
  • synth_dir (str) – path to synthesized image directory
  • truth_dir (str) – path to truth image directory
  • out_dir (str) – path to save directory
  • mask_dir (str) – path to directory of corresponding masks (not needed)
  • outtype (str) – type of file to output (e.g., png, pdf, etc.)
  • mean (bool) – option to use the mean of all images in directory
Returns:

None

synthqc.plot.synth_quality.plot_synth_quality(synth, truth, mask, mean=False)

create a radar plot of the (absolute value of the) metrics correlation, mattes mutual information, and ssim

Parameters:
  • synth (np.ndarray or list) – synthesized image
  • truth (np.ndarray or list) – image we are trying to synthesize
  • mask (np.ndarray or list) – mask for the images
  • mean (bool) – option to use the mean of all images in list (that is, synth, truth, and mask are lists of ANTsImages)
Returns:

ax that the plot was created on

Return type:

ax (matplotlib ax object)

Directory View

synthqc.plot.directory_view

create profile view images of all images in a directory

Author: Jacob Reinhold (jacob.reinhold@jhu.edu)

Created on: Jun 20, 2018

synthqc.plot.directory_view.directory_view(img_dir, out_dir=None, labels=None, figsize=(8, 8), outtype='png', slices=None, axis=0, trim=True, dpi=200)

create images for a directory of nifti files

Parameters:
  • img_dir (str) – path to directory
  • out_dir (str) – path to save directory
  • labels (str) – path to directory of corresponding labels (not needed)
  • figsize (float) – size of output image
  • outtype (str) – type of file to output (e.g., png, pdf, etc.)
  • slices (tuple) – plot these slices in axial view (instead of ortho)
  • axis (int) – axis from which to sample (0<=axis<=2)
  • trim (bool) – trim blank/white space from image (need to have imagemagick installed)
Returns:

None