Sisyphe.core.sisypheDicom
External packages/modules
Numpy, scientific computing, https://numpy.org/
pandas, data analysis and manipulation tool, https://pandas.pydata.org/
pydicom, DICOM library, https://pydicom.github.io/pydicom/stable/
PyQt5,Qt GUI, https://www.riverbankcomputing.com/software/pyqt/
SimpleITK, medical image processing, https://simpleitk.org/
skimage, image processing, https://scikit-image.org/
- class Sisyphe.core.sisypheDicom.DicomToXmlDicom
Description
Dicom file to XmlDicom file conversion. XmlDicom file stores DICOM fields in a key/value XML file.
Inheritance
object -> DicomToXmlDicom
Creation: 08/09/2022 Last Revision: 27/03/2025
- addDicomSeriesFilenames(filenames: list[str]) None
Add a list of DICOM file names to the list of conversion.
Parameters
- filenameslist[str]
list of DICOM file names
- clear() None
Reset all DicomToXmlDicom attributes.
- clearDicomSeriesFilenames() None
Clear the list of DICOM file names to convert.
- execute() None
Run Dicom to XmlDicom conversion.
- getBackupXmlDicomDirectory() str
Get path of the XmlDicom backup folder.
Returns
- str
path of the backup folder
- classmethod getDefaultXmlDicomFilename(ds: Dataset) str
Get default XmlDicom file name from DICOM fields.
Parameters
- dspydicom.Dataset
DICOM fields
Returns
- str
‘{lastname}_{firstname}_{birth_date}_{modality}_{acquisition_date}_{series_description}.xdcm’
- getDicomSeriesFilenames() list[str]
Get the list of DICOM file names to convert.
Returns
- list[str]
list of DICOM file names
- hasDicomSeriesFilenames() bool
Check that the list of DICOM file names is not empty.
Returns
- bool
True if list is not empty
- isDefaultBackupXmlDicomDirectory() bool
Checks whether path of the backup folder is defined. In this case, backup folder is the path of the Dicom files.
Returns
- bool
True if backup folder path is not defined
- setBackupXmlDicomDirectory(path: str) None
Set the path of the XmlDicom backup folder.
Parameters
- pathstr
path of the backup folder
- class Sisyphe.core.sisypheDicom.DicomUIDGenerator
Description
Class to generate Dicom UID (study UID, series UID, instance UID, FrameOfReference UID) and Date/Time for various Dicom fields. This UID generator is used by DICOM import/export classes. UID is a Dicom ID code compliant with ISO-8824 standard.
Inheritance
object -> DicomUIDGenerator
Creation: 08/09/2022 Last revision: 11/12/2023
- classmethod getCTSOPClassUID() str
Get UID of the CT modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.2’
- getCurrentFrameOfReferenceUID() str
Get current FrameOfReferenceUID.
Returns
- str
FrameOfReference UID
- classmethod getImplementationClassUID() str
Get implementation class UID (i.e. ID of the application/service class user) UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.826.0.1.3680043.1.2.100.6.40.0.76’
- classmethod getImplementationVersionName() str
Get implementation version name (i.e. name of the application/service class user)
Returns
- str
‘PySisyphe’
- classmethod getMRSOPClassUID() str
Get UID of the MR modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.4’
- classmethod getNMSOPClassUID() str
Get UID of the NM modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.20’
- classmethod getOTSOPClassUID() str
Get UID of the OT modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.7’
- classmethod getPTSOPClassUID() str
Get UID of the PT modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.128’
- classmethod getRTDoseSOPClassUID() str
Get UID of the RTDOSE modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.481.2’
- classmethod getRTImageSOPClassUID() str
Get UID of the RTIMAGE modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.481.1’
- classmethod getRTStructSOPClassUID() str
Get UID of the RTSTRUCT modality. UID = Dicom ID, ISO8824 format.
Returns
- str
‘1.2.840.10008.5.1.4.1.1.481.3’
- classmethod getRootUID() str
Get root UID, str Prefix used to generate various UID codes. UID = Dicom ID, ISO8824 format.
Returns
- str
UID prefix ‘1.2.840.12052’
- classmethod getSOPClassUIDFromModality(modality: str) str
Get modality UID. UID = Dicom ID, ISO8824 format.
Parameters
- modalitystr
Dicom modality (‘CT’, ‘MR’, ‘NM’, ‘PT’, ‘OT’, ‘RTDOSE’, ‘RTSTRUCT’)
Returns
- str
modality UID
- newInstance() None
Generates current InstanceUID and increments instance index.
- newSeries() None
Generates current SeriesUID and FrameOfReferenceUID, increments series index.
- newStudy() None
Generates current StudyUID.
- class Sisyphe.core.sisypheDicom.ExportToDicom
Description
Class to convert PySisyphe volume (.xvol) to Dicom format.
Inheritance
object -> ExportToDicom
Creation: 08/09/2022 Last revision: 27/03/2025
- clear() None
Reset all ExportToDicom instance attributes.
- execute(progress: DialogWait | None = None) None
Run PySisyphe volume (.xvol) to Dicom conversion.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- getBackupDicomDirectory() str
Get the path of the backup folder. Dicom files are saved in this directory.
Returns
- str
path of the backup folder
- classmethod getSettingsDirectory() str
Get PySisyphe user settings path (~/.PySisyphe/settings.xml in user folder).
Returns
- str
PySisyphe user settings path
- getVolume() SisypheVolume
Get PySisyphe volume (.xvol) to convert.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
volume (.xvol) to convert
- getXmlDicomReference() str
Get XmlDicom reference (.xdcm). Dicom fields of the XmlDicom reference are used as a template for writing Dicom file.
Returns
- str
XmlDicom file name
- hasVolume() bool
Checks whether PySisyphe volume to convert is defined.
Returns
- bool
True if PySisyphe volume to convert is defined
- hasXmlDicomReference() bool
Checks whether XmlDicom reference is defined.
Returns
- bool
True if PySisyphe volume to convert is defined
- isDefaultBackupDicomDirectory() bool
Checks whether backup folder is defined. The default backup folder is the path of the PySisyphe volume.
Returns
- bool
True if backup folder is not defined
- setBackupDicomDirectory(path: str) None
Set the path of the backup folder. Dicom files are saved in this directory.
Parameters
- pathstr
path of the backup folder
- setVolume(vol: SisypheVolume) None
Set PySisyphe volume (.xvol) to convert.
Parameters
- volSisyphe.core.sisypheVolume.SisypheVolume
volume (.xvol) to convert
- class Sisyphe.core.sisypheDicom.ExportToRTStruct
ExportToRTStruct class
Description
Class to convert PySisyphe ROI (.xroi) to Dicom RTSTRUCT.
Inheritance
object -> ExportToRTStruct
Creation: 08/09/2022 Last revision: 27/03/2025
- addROI(roi: str | SisypheROI) None
Add PySisyphe ROI to the list of conversion. PySisyphe ROI must have the same ID as the PySisyphe reference volume.
Parameters
- roistr | Sisyphe.core.sisypheROI.SisypheROI
PySisyphe ROI file name or instance
- clear() None
Reset all ExportToRTStruct instance attributes.
- execute(progress: DialogWait | None = None) None
Run PySisyphe ROI (.xroi) to Dicom RTSTRUCT conversion.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait
progress bar dialog (optional)
- getExportFolder() str
Get the path of the backup folder. Dicom RTSTRUCT file is saved in this directory.
Returns
- str
path of the backup folder
- getROI() SisypheROICollection
Get PySisyphe ROI(s) to convert.
Returns
- Sisyphe.core.sisypheROI.SisypheROICollection
ROIs list to convert
- getReferenceVolume() SisypheVolume
Get PySisyphe reference volume (.xvol). Dicom RTSTRUCT is always associated to a reference anatomical volume. PySisyphe reference is also converted to Dicom format during execute method. PySisyphe ROI to convert must have the same ID as the PySisyphe reference volume.
Returns
Sisyphe.core.sisypheVolume.SisypheVolume
- classmethod getSettingsDirectory() str
Get PySisyphe user settings folder (~/.PySisyphe/settings.xml in user folder).
Returns
- str
PySisyphe user settings folder
- hasExportFolder() bool
Checks whether backup folder is defined.
Returns
- bool
True if backup folder is defined
- hasROI() bool
Checks whether PySisyphe ROIs list of conversion is not empty.
Returns
- bool
True if PySisyphe ROIs list of conversion is not empty
- hasReferenceVolume() bool
Checks whether PySisyphe reference volume is defined.
Returns
- bool
True if PySisyphe volume is defined
- setExportFolder(folder: str) None
Set the path of the backup folder. Dicom RTStruct file is saved in this directory.
Parameters
- folderstr
path of the backup folder
- setReferenceVolume(vol: str | SisypheVolume) None
Set PySisyphe reference volume (.xvol). Dicom RTSTRUCT is always associated to a reference anatomical volume. PySisyphe reference is also converted to Dicom format during conversion. PySisyphe ROI to convert must have the same ID as the PySisyphe reference volume.
Parameters
- volstr | Sisyphe.core.sisypheVolume.SisypheVolume
PySisyphe reference volume file name (.xvol) or instance
- class Sisyphe.core.sisypheDicom.ImportFromDicom
Description
Class to convert Dicom files to PySisyphe volume (.xvol).
Inheritance
object -> ImportFromDicom
Creation: 08/09/2022 Last revision: 07/03/2025
- clear() None
Reset all ImportFromDicom instance attributes.
- execute(progress: DialogWait | None = None, getdirs: bool = False) SisypheVolume | None
Run Dicom to PySisyphe volume (.xvol) conversion.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait
progress bar dialog (optional)
- getdirsbool
if True, copy PySisyphe volume origin and direction attributes from Dicom fields, otherwise set PySisyphe volume origin and direction attributes to default
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
converted PySisyphe volume
- getDicomFilenames() list[str]
Get Dicom file names to convert.
Returns
- str
list of Dicom file names
- getDicomImagePositionPatient() list[float]
Get PositionPatient Dicom field values from Dicom Files to convert.
Returns
- list[float]
list of PositionPatient Dicom field values
- getImportFolder() str
Get path of the backup folder. PySisyphe volume is saved in this directory.
Returns
- str
path of the backup folder
- getReferenceUID() str
Get Dicom files reference UID (i.e. FrameOfReferenceUID)
Returns
- str
Dicom files reference UID
- getReferenceVolume() SisypheVolume
Get converted PySisyphe volume.
Returns
Sisyphe.core.sisypheVolume.SisypheVolume
- getSaveTag() bool
Get save tag value. If tag is True, PySisyphe volume is saved during execute method.
Returns
- bool
save tag value
- hasImportFolder() bool
Checks whether backup folder is defined. The default backup folder is the path of the Dicom files.
Returns
- bool
True if backup folder is defined
- hasReferenceUID() bool
Checks whether Dicom files reference UID is defined.
Returns
- bool
True if Dicom files reference UID is defined
- hasReferenceVolume() bool
Checks whether converted PySisyphe volume exists (False before calling execute method).
Returns
- bool
True if PySisyphe volume exists
- isEmpty() bool
Checks if ImportFromDicom is empty, Dicom files to convert are not defined.
Returns
- bool
True if Dicom files to convert are not defined
- saveReferenceVolume(progress: DialogWait | None = None) None
Save converted PySisyphe volume.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait | None
progress bar dialog (optional)
- setDicomFilenames(filenames: list[str]) None
Set Dicom file names to convert. All files must belong to the same Dicom series. Dicom fields used to detect Dicom series:
(0x0008, 0x0018) SOPInstanceUID
(0x0020, 0x000e) SeriesInstanceUID
(0x0020, 0x0032) ImagePositionPatient
(0x0020, 0x0052) FrameOfReferenceUID
Parameters
- filenamesstr
list of Dicom file names
- class Sisyphe.core.sisypheDicom.ImportFromRTDose
Description
Class to convert Dicom RTDose to PySisyphe volume (.xvol).
Inheritance
object -> ImportFromDicom -> ImportFromRTDose
Creation: 08/09/2022 Last revision: 07/03/2025
- addRTDoseFilename(filenames: str | list[str]) None
Add Dicom RTDose file names to convert. Dicom fields used:
(0x0008, 0x0060) Modality
(0x0020, 0x0052) FrameOfReferenceUID
Parameters
- filenamesstr | list[str]
list of Dicom RTDose file names
- clear() None
Reset all ImportFromRTDose instance attributes.
- execute(progress: DialogWait | None = None, getdirs: bool = False) SisypheVolumeCollection | None
Run Dicom RTDose to PySisyphe volume (.xvol) conversion.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait
progress bar dialog
- getdirsbool
if True, copy PySisyphe volume origin and direction attributes from Dicom fields, otherwise set PySisyphe volume origin and direction attributes to default
Returns
- Sisyphe.core.sisypheVolume.SisypheVolumeCollection
converted PySisyphe volumes
- getRTDoseFilename() list[str]
Get Dicom RTDose file names to convert.
Returns
- list[str]
list of Dicom RTDose file names
- getRTDoseVolume() SisypheVolumeCollection
Get converted PySisyphe volumes.
Returns
Sisyphe.core.sisypheVolume.SisypheVolumeCollection
- hasRTDoseFilename() bool
Checks whether Dicom RTDose files to convert are defined.
Returns
- bool
True if Dicom RTDose files to convert are defined
- hasRTDoseVolume() bool
Checks whether converted PySisyphe volumes exists (False before calling execute method).
Returns
- bool
True if PySisyphe volume exists
- saveRTDoseVolume() None
Save converted PySisyphe volumes.
- class Sisyphe.core.sisypheDicom.ImportFromRTStruct
Description
Class to convert Dicom RTSTRUCT to PySisyphe ROI (.xroi).
Inheritance
object -> ImportFromDicom -> ImportFromRTStruct
Creation: 08/09/2022 Last revision: 07/03/2025
- addRTStructFilename(filenames: str | list[str]) None
Add Dicom RTStruct file names to convert. Dicom fields used:
(0x0008, 0x0060) Modality
(0x0020, 0x0052) FrameOfReferenceUID
Parameters
- filenamesstr
list of Dicom RTDose file names
- clear() None
Reset all ImportFromRTStruct instance attributes.
- execute(progress: DialogWait | None = None, getdirs: bool = False) SisypheROICollection
Run Dicom RTStruct to PySisyphe roi (.xroi) conversion.
Parameters
- progressSisyphe.gui.dialogWait.DialogWait
progress bar dialog (optional)
- getdirsbool
if True, copy PySisyphe volume origin and direction attributes from Dicom fields, otherwise set PySisyphe volume origin and direction attributes to default
Returns
- Sisyphe.core.sisypheROI.SisypheROICollection
converted PySisyphe rois
- getRTStructFilename() list[str]
Get Dicom RTStruct file names to convert.
Returns
- list[str]
list of Dicom RTStruct file names
- getRTStructLabel() SisypheVolume
Get converted PySisyphe label volume.
Returns
- Sisyphe.core.sisypheVolume.SisypheVolume
label volume
- getRTStructROI() SisypheROICollection
Get converted PySisyphe ROIs.
Returns
Sisyphe.core.sisypheROI.SisypheROICollection
- hasRTStructFilename() bool
Checks whether Dicom RTStruct files to convert are defined.
Returns
- bool
True if Dicom RTStruct files to convert are defined
- hasRTStructROI() bool
Checks whether converted PySisyphe rois exists (False before calling execute method).
Returns
- bool
True if PySisyphe rois exists
- saveRTStructLabel() None
Save converted PySisyphe label volume.
- saveRTStructROI() None
Save converted PySisyphe ROIs.
- class Sisyphe.core.sisypheDicom.XmlDicom
Description
Class to get field values from XmlDicom file. XmlDicom file stores DICOM fields in a key/value XML file.
Scope of methods:
container-like methods for accessing DICOM fields
IO methods (Xml, Text, Matfile, CSV, Excel, Latex)
Inheritance
object -> XmlDicom
Creation: 08/09/2022 Last revisions: 11/12/2023
- clear() None
Delete all Dicom fields.
- copyDataElementValuesToClipboard(keys: list[str], sep: str = '\t') None
Copy a list of Dicom fields to clipboard.
Parameters
- keyslist[str]
list of Dicom field names to copy
- sepstr
separator char between Dicom fields (default ‘ ‘)
- findKeywords(flt: str) list[str] | None
Search for Dicom fields from a string or substring.
Parameters
- fltstr
string to search Dicom fields names
Returns
- list[str]
list of Dicom field names
- getDataElement(keyword: str) DataElement | list[DataElement] | None
Copy a Dicom field in a pydicom.DataElement. Returns a list of pydicom.DataElement if Dicom field value is not constant in all Dicom instances of a series. In this case, there is a pydicom.Element for each Dicom instance.
Parameters
- keywordstr
Dicom field name
Returns
pydicom.Element | list[pydicom.Element]
- getDataElementVM(keyword: str) int | None
Get Dicom field VM attribute (Value multiplicity) from field name as str key. Some dicom fields have multiple values (vector), VM gives value count of the field.
Parameters
- keywordstr
Dicom field name
Returns
- str
VM value count of the DICOM field
- getDataElementVR(keyword: str) str | None
Get Dicom field VR attribute (Value representation i.e. Dicom datatype code) from field name as str key. Dicom datatype is a two-chars str code.
Parameters
- keywordstr
Dicom field name
Returns
- str
VR Dicom datatype code
- getDataElementValue(keyword: str) int | float | str | list[int] | list[float] | None
Get Dicom field (Data element) value from field name as str key.
Parameters
- keywordstr
Dicom field name
Returns
- int | float | str | list[int] | list[float]
Dicom field value
- getDataset(index: int = 0) Dataset
Copy all Dicom Fields in a pydicom.Dataset.
Parameters
- indexint
Dicom instance index to copy (default 0)
Returns
pydicom.Dataset
- classmethod getFilterExt() str
Get XmlDicom filter used by QFileDialog.getOpenFileName() and QFileDialog.getSaveFileName().
Returns
- str
‘PySisyphe XmlDicom (.xdcm)’
- getKeywords() list[str] | None
Get list of all Dicom field names in XmlDicom instance.
Returns
- list[str]
list of Dicom field names
- getKeywordsWithConstantValue() list[str] | None
Get list of Dicom fields with constant value (same value in all Dicom instances).
Returns
- list[str]
list of Dicom field names
- getKeywordsWithValueVariation() list[str] | None
Get list of Dicom fields having a value variation with Dicom instances (one value for each Dicom instance).
Returns
- list[str]
list of Dicom field names
- getNumerOfDatasets() int
Get the number of Dicom instances in the current XmlDicom instance.
Returns
- int
Dicom instance count
- getSheet(keys: list[str]) SisypheSheet
Copy a list of Dicom fields to a Sisyphe.core.sisypheSheet.SisypheSheet.
Parameters
- keyslist[str]
list of Dicom fields
Returns
Sisyphe.core.sisypheSheet.SisypheSheet
- hasKeyword(keyword: str) bool
Checks whether a Dicom field is in XmlDicom instance.
Parameters
- keywordstr
Dicom field name
Returns
- bool
True if field is in XmlDicom instance
- isEmpty() bool
Checks if XmlInstance is empty (no Dicom field).
Returns
- bool
True if XmlInstance is empty
- loadXmlDicomFilename(filename: str) None
Load XmlDicom file.
Parameters
- filenamestr
XmlDicom file name
- saveDataElementValuesToCSV(keys: list[str], filename: str) None
Save a list of Dicom fields in a CSV file.
Parameters
- keyslist[str]
list of Dicom field names to save
- filenamestr
CSV file name
- saveDataElementValuesToExcel(keys: list[str], filename: str) None
Save a list of Dicom fields in an Excel file.
Parameters
- keyslist[str]
list of Dicom field names to save
- filenamestr
Excel file name
- saveDataElementValuesToLATEX(keys: list[str], filename: str) None
Save a list of Dicom fields in a LaTeX file.
Parameters
- keyslist[str]
list of Dicom field names to save
filename : str, LaTeX file name
- saveDataElementValuesToMatfile(keys: list[str], filename: str) None
Save a list of Dicom fields in a Matlab file.
Parameters
- keyslist[str]
list of Dicom field names to save
- filenamestr
Matlab file name
- Sisyphe.core.sisypheDicom.getAcquisitionFromDicom(filename: str, useacqnumber: bool = False) SisypheAcquisition
Get acquisition attributes (Sisyphe.core.SisypheImageAttributes.SisypheAcquisition) in DICOM file.
Dicom fields used:
0x0008, 0x0020 Study Date
0x0008, 0x0021 Series Date
0x0008, 0x0022 Acquisition Date
0x0008, 0x0023 Content Date
0x0008, 0x0060 Modality
0x0008, 0x103e Series Description
0x0018, 0x0010 Contrast/Bolus Agent
0x0018, 0x0023 MR Acquisition Type (2D or 3D)
0x0020, 0x0012 Acquisition Number
Parameters
- filenamestr
Dicom file name
- useacqnumberbool
Add acquisition number in the SisypheAcquisition sequence attribute
Returns
- Sisyphe.core.SisypheImageAttributes.SisypheIdentity
patient identity
- Sisyphe.core.sisypheDicom.getDicomImageModalities() list[str]
Get list of DICOM image modalities. DICOM modality format is two-chars str for images.
Returns
- list[str]
[‘CT’, ‘MR’, ‘NM’, ‘PT’, ‘OT’]
- Sisyphe.core.sisypheDicom.getDicomModalities() list[str]
Get list of DICOM modalities. DICOM modality format is two-chars str for images.
Returns
- list[str]
[‘CT’, ‘MR’, ‘NM’, ‘PT’, ‘OT’, ‘RTDOSE’, ‘RTSTRUCT’]
- Sisyphe.core.sisypheDicom.getDicomRTModalities() list[str]
Get list of DICOM radiotherapy modalities.
Returns
- list[str]
[‘RTDOSE’, ‘RTSTRUCT’]
- Sisyphe.core.sisypheDicom.getDiffusionParametersFromDicom(filename: str) dict[slice(<class 'str'>, <class 'float'>, None), slice(<class 'str'>, list[float], None)]
Get diffusion attributes B-value and gradient direction in DICOM file.
Parameters
- filenamestr
Dicom file name
Returns
- dict[str: float, str: list[float]]
- Key/Value
‘bval’: float, B-value
‘bvec’: list[float], gradient direction vector
- Sisyphe.core.sisypheDicom.getIdentityFromDicom(filename: str) SisypheIdentity
Get patient identity information (Sisyphe.core.SisypheImageAttributes.SisypheIdentity) from DICOM file.
Dicom fields used:
PatientName
PatientBirthDate
PatientSex
Parameters
- filenamestr
Dicom file name
Returns
- Sisyphe.core.SisypheImageAttributes.SisypheIdentity
patient identity
- Sisyphe.core.sisypheDicom.loadBVal(filename: str, format='txt', numpy=False) dict[slice(<class 'str'>, <class 'float'>, None)] | ~numpy.ndarray
Load gradient B-values.
Parameters
- filenamestr
file name (.bval, .xbval or .txt)
- formatstr
‘xml’, xml format <bvalue file=filename>v</bvector>
‘txt’, txt format, v[0] -> v[1] … -> v[n]
- numpybool
return type is ndarray (True) or dict (False)
Returns
- ndarray | dict[str: float]
- if numpy parameter is False:
key str, diffusion weighted image file name (.xvol) or index number
value float, B-value
- Sisyphe.core.sisypheDicom.loadBVec(filename: str, format='txtbydim', numpy=False) dict[slice(<class 'str'>, [<class 'float'>, <class 'float'>, <class 'float'>], None)] | ~numpy.ndarray
Load gradient direction vector.
Parameters
- filenamestr
file name (.bvec, .xbvec or .txt)
- formatstr
‘xml’, xml format <bvector file=filename>v0[0] v0[1] v0[2]</bvector>
‘txtbyvec’, txt format, vector order, v0[0] -> v0[1] -> v0[2] -> … -> vn[0] -> vn[1] -> vn[2]
‘txtbydim’, txt format, dimension order, v0[0] -> … -> vn[0], v0[1] -> … -> vn[1], v0[2] -> … -> vn[2]
- numpybool
return type is ndarray (True) or dict (False)
Returns
- ndarray | dict[str: [float, float, float]]
- if numpy parameter is False:
key str, diffusion weighted image file name (.xvol) or index number,
value [float, float, float], gradient direction vector
- Sisyphe.core.sisypheDicom.mosaicImageToVolume(slc: ndarray, n: int) ndarray
Siemens Mosaic 2D image to 3D volume conversion. Mosaic is a grid of n^2 images (n columns x n rows), all the slices of a volume are stored in a single DICOM mosaic file.
Parameters
- slcnumpy.ndarray
2D mosaic image (ndarray, ndim=2)
- nint
columns/rows count
Returns
- numpy.ndarray
3D volume
- Sisyphe.core.sisypheDicom.removeSuffixNumberFromFilename(filename: str) str
Remove numerical suffix from a file name. ex: ‘../image_01.xvol’ -> ‘../image.xvol’
Parameters
- filenamestr
file name
Returns
- str
file name
- Sisyphe.core.sisypheDicom.saveBVal(filename: str, bval: dict[slice(<class 'str'>, <class 'float'>, None)], format: str = 'txt') None
Save gradient B-values.
Parameters
- filenamestr
file name (.bval, .xbval or .txt)
- bvaldict[str: float]
key str, diffusion weighted image file name (.xvol) or index number
value float, B value
- formatstr
‘xml’, xml format <bvalue file=filename>v</bvector>
‘txt’, txt format, v[0] -> v[1] … -> v[n]
- Sisyphe.core.sisypheDicom.saveBVec(filename: str, bvec: dict[slice(<class 'str'>, [<class 'float'>, <class 'float'>, <class 'float'>], None)], format='txtbydim') None
Save gradient direction vector.
Parameters
- filenamestr
file name (.bvec, .xbvec or .txt)
- bvecdict[str: [float, float, float]],
key str, diffusion weighted image file name (.xvol) or index number
value [float, float, float], gradient direction vector
- formatstr
‘xml’, xml format <bvector file=filename>v0[0] v0[1] v0[2]</bvector>
‘txtbyvec’, txt format, vector order, v0[0] -> v0[1] -> v0[2] -> … -> vn[0] -> vn[1] -> vn[2]
‘txtbydim’, txt format, dimension order, v0[0] -> … -> vn[0], v0[1] -> … -> vn[1], v0[2] -> … -> vn[2]