glmdenoise.io.output module

class glmdenoise.io.output.Output[source]

Bases: object

Service which stores results in files

configure_from(sample_file)[source]

Supply one input file to initialize output

Parameters:sample_file (str) – Path to nifti file for one run
create_report()[source]

Return a Report object configured to use this Output object

Returns:Report object with methods to create figures
Return type:glmdenoise.report
ensure_directory()[source]

Make sure that the output directory exist.

Tries to create the output directory if it isn’t there yet.

file_path(tag, ext)[source]

Obtain output file path for the given variable name and extension

Parameters:
  • tag (str) – Variable to save
  • ext (str) – File extension without leading dot
Returns:

Absolute file path for file to save

Return type:

str

fit_bids_context(bids, sub, ses, task)[source]

Provide BIDS context including subject, session and task

Parameters:
safe_name(name)[source]

Remove spaces etc so it can be used as html identifier

Parameters:name (str) – Title or name
Returns:name without special characters
Return type:str
save_figure(figure, name)[source]

Save the figure object as a png file

Parameters:
  • figure (matplotlib.figure.Figure) – Figure object
  • name (str) – name of the plot
Returns:

absolute filepath to new png file

Return type:

str

save_gif(names, gifname)[source]

Save the image_array object as a gif file

Parameters:
  • stack (image) –
  • name (str) – name of the gif
Returns:

absolute filepath to new gif file

Return type:

str

save_image(imageArray, name)[source]

Store brain image data in a nifti file using nibabel

Parameters:
  • imageArray (ndarray) – data in vector form. If multiple volumes, they should be in the first dimension.
  • name (str) – The name of the variable
save_text(text, name, ext)[source]

Store text file

Parameters:
  • text (str) – string content
  • name (str) – filename
  • ext (str) – file extension
save_variable(var, name)[source]

Store non-brain-image data in a file

Parameters:
  • var – The value to store
  • name (str) – The name of the variable