mrsprint package

Submodules

mrsprint.globals module

Global values.

Authors:
Since:
2015/06/01

mrsprint.mainwindow module

Main window of visual simulator.

Authors:
Since:
2017/08/01

Todo

Replaning this module, divide and make it more simple.

class mrsprint.mainwindow.MainWindow(parent=None)[source]

Bases: PyQt4.QtGui.QMainWindow

Main window.

About load methods:
This method should exist for each type of context that could be edited in the 2D editor and 3D view. Ex. loadSystemParameters. It should be responsible for loading values from parameter tree, connect signals - to respective own actions, and set data.To keep it isolated, it should set data, and when data is changed, data triggers the GUI update. And the reverse mode.
about()[source]

Show about message.

canClose()[source]

Check if the user want to save the sample before closing.

Returns:True if can close.
Return type:bool
clearSelection2DEditor(all_tables=False)[source]

Clear selection of all 2D editor tables.

Parameters:all_tables (bool) – Informs if all tables are shown or not. Default is False.
closeEvent(event)[source]

Close event.

create3DView()[source]

Create a 3D view and the first 3D object.

It must be called when starts and when the shape or size is changed.

enableGradient2DEditor()[source]

Enable the gradient editor for 2D editor.

fileClose()[source]

Close file and create a new one.

fileNew()[source]

Restart the edition from start.

fileOpen()[source]

Open a dialog to select a HDF5 file to be opened.

fileSave()[source]

Save the current sample in the last saving file.

If there is no current saving file, it calls fileSaveAs().

fileSaveAs()[source]

Open a dialog to select the current saving file.

gradient2DEditor()[source]

Run the gradient editor and set values to 2D editor tables.

Todo

Remove eval after changing itemMethodsTable2dEditor.

invertBackground2DEditor(invert=False)[source]

Invert the background color of 2D editor.

invertBackground3DView(invert=False)[source]

Invert the background color of 3D view.

Parameters:invert (bool) – Informs if the background color should be inverted. Default is False.
itemsMethodsTable2DEditor()[source]

Return current selected item, methods to access their indexes and the table.

Returns:The current selected items, the methods attached to the selected table and the selected table
Return type:list (QtGui.QTableWidgetItem()), dict (string of methods), QtGui.QTableWidget()

Todo

This could be even better if getting these values, return just a new matrix with proper indexes and values to set data.

loadProcessingParameters()[source]

Load processing parameters and connect signals.

loadSampleParameters()[source]

Load sample context and its parameters.

loadSequenceParameters()[source]

Load sequence context and its parameters.

loadSettings()[source]

Load all the config parameters needed by the software.

loadSimulatorParameters()[source]

Load simulator context and its parameters.

loadSystemParameters()[source]

Load system context and its parameters.

open(file_path)[source]

Open a HDF5 file and applies the changes to the program.

Parameters:file_path (str) – Path to the file where the data will be opened.
openSample(file_path)[source]

Open a HDF5 sample file.

Parameters:file_path (str) – Path to a file containing a sample.
openSequence(file_path)[source]

Open a python sequence file.

The file must contain a class SequenceExample, that contains information about the sequence as RF pulses and the Gradient.

Parameters:file_path (str) – Path to a file containing the sequence.
openSystem(file_path)[source]

Open a HDF5 system file.

Parameters:file_path (str) – Path to a file containing the system.
plotSequence()[source]

Use the data from a sequence to create the RF and Gradient plots.

quit()[source]

Close the main window.

resizeTable2DEditor()[source]

Change the size of the tableWidgets whenever a row/column is added/removed.

sampleSettingsChanges()[source]

Reload sample parameters.

save(file_path)[source]

Create a HDF5 file to save current data.

Parameters:file_path (str) – Path to the file where the data will be saved.
saveSample(file_path)[source]

Save a HDF5 sample file.

Parameters:file_path (str) – Path to the file where the sample will be saved.
saveSystem(file_path)[source]

Save a HDF5 system file.

Parameters:file_path (str) – Path to the file where the system will be saved.
setIndexLimits2DEditor(nx, ny, nz)[source]

Set index limits for 2D editor.

Parameters:
  • nx (int) – Shape of data in the x dimension.
  • ny (int) – Shape of data in the y dimension.
  • nz (int) – Shape of data in the z dimension.
setSettingsPath()[source]
showAxis3DView(show=True)[source]

Show axis in 3D view.

Parameters:show (bool) – Informs if the axis should be visible. Default is True.
simulate()[source]

Setup a simulation.

simulatorSettingsChanges()[source]

Reload simulator parameters.

systemSettingsChanges()[source]

Reload system parameters.

tabify2DEditor(value)[source]

Tabify 2D editor depending on value.

Parameters:value (bool) – Informs if the tables in 2DEditor should be tabified or not.
translateGrid3DView()[source]

Translate grids to correct position.

updateContext()[source]

If context is changed, update interface.

updateDataFromTable2DEditor(item_changed)[source]

Update data from table in 2D editor.

updateExplorer()[source]

Update explorer files for current context.

updateObserverData()[source]

Reread data and apply updates.

updateObserverDataSize()[source]

Reread data and apply updates, maybe need some rebuild.

updateObserverIndex()[source]

Reread indexes and apply updates, does not need recreated anything.

updateSelectedCells(value, index)[source]

Update selected cells from parameter tree.

Parameters:
  • value (float) – Value to be updated in the table.
  • index (int) – Index of selected type of data.
updateTableFromData2DEditor()[source]

Update items of all 2D editor using 3d-array data and set color.

This method is called when the data shape is changed or when the plane index is changed. Also, when the data index is changed.

updateViewFromData3DView()[source]

Color 3D view based on 3D data.

mrsprint.settings module

Module responsible for the configuration of settings of all other modules.

Authors:
Since:
2017/07/01

Todo

Insert log inside functions.

class mrsprint.settings.Settings(*args, **kwargs)[source]

Bases: PyQt4.QtGui.QMainWindow

Main window for settings.

Todo

Include restore default settings. Create a better check for values.

blockUnblockSignals(value)[source]

Block or unblock signals defined by value.

Parameters:value (bool) – True to block, false otherwise.
check()[source]

Evaluate if parameters are between its limits before saving them.

Returns:True if OK.
Return type:bool

Todo

Reduce complexity and check all value limits.

open(file_path, set_file=True)[source]

Open a HDF5 settings file.

Parameters:
  • file_path (str) – Path to a file containing the settings.
  • set_file (bool) – set path file if true, otherwise just import.
openFile(set_file=True)[source]

Open a dialog to select the config file to be opened.

save(file_path, set_file=True)[source]

Save a HDF5 settings file.

Parameters:
  • file_path (str) – Path to a file containing the settings.
  • set_file (bool) – set path file if true, otherwise just export.
saveFile(set_file=True)[source]

Open a dialog to select the config file to be saved.

Module contents

Magnetic resonance experiment simulator and visualization tool.

Authors:
Since:
2015/07/01