Protocol: Generic Framework for Acquisition Protocols#
Documentation: https://raamana.github.io/protocol/
The protocol library provides a simple API for creating sequences and acquisition protocols. You can check if acquisition parameters for two imaging sequences are same. Sequences can also be checked for compliance against a reference protocol (XML) generated from Siemens scanners.
from protocol import ImagingSequence
from pydicom import dcmread
from protocol import SiemensMRImagingProtocol
dcm_seq1 = dcmread('path/to/dicom')
dcm_seq2 = dcmread('path/to/dicom')
seq1 = ImagingSequence(dicom=my_dicom)
seq2 = ImagingSequence(dicom=sub2_dicom)
is_compliant = seq1.compliant(seq2)
reference_protocol = SiemensMRImagingProtocol(filepath='path/to/xml')
# Get sequence from the protocol with the same name, e.g. t1w
reference_sequence = reference_protocol[seq1.name]
compliant_flag, non_compliant_parameters = reference_sequence.compliant(seq1)
The non_compliant_parameters
is a list of tuples containing the parameters that are not same as in
the reference_sequence
. The first element of the tuple is the parameter in the reference_sequence
and
the second element is the parameter in the seq1
.