mrrc-hdr-qa documentation

Code to parse dicoms into a template database and alert on non-conforming sequences.

Code

mrqart

Broadcast filesystem updates (via inotify) over websockets.

dcmmeta2tsv

Give a tab separated metadata value line per dicom file.

acq2sqlite

Convert db.txt into a sqlite database.

change_header

Modify DICOM header information to simulate failing QA.

template_checker

check a header against best template

compliance_check_html

mrrc_dbupdate

Find MRRC organized study acquisitions directories newer than what's in the DB and update them.

Overview

MRQART

MR Quality Assurance in (near) Real Time. See see static debug-enabled page for a demonstration. Full toolchain uses

  1. Samba server receives files from scanner (iceconfig)

  2. mrqart.main() initializes an inotify watcher

  3. New dcm files parsed with dcmmeta2tsv.DicomTagReader.read_dicom_tags()

  4. Headers compared to template template_checker.TemplateChecker.check_header()

  5. Dicom vs template comparisons is sent to the web browser via web sockets

    • socket and http server managed by mrqart

    • javascript in static/index.html provides client websockets ingest and styling

_images/mrqart-browserUI_20241124.png

Template

See acq2sqlite.DBQuery.CONSTS

Here’s an example for the RewardedAnti task acquisitions in the WPC-8620 project. The ideal template is found finding the most frequent set of repeated key parameters. 150 of the RewardedAnti seqeuences share the same acq_param set, here stored in the sqlite db on rowid=35. But 4 acquisitions (rows in acq) don’t match. In this case all mismatches can be found in TA.

_images/nonconforming_example.png

Parameters

Dicom tag list

name

tag

desc

Phase

PhaseEncodingDirectionPositive

csa header phase 0/1

iPAT

ImaPATModeText

csa header grappa acceleration

AcqTime

00080032

Acquisition Time like 145446.685000

AcqDate

00080022

like 20241004

SeriesNumber

00200011

REL Series Number

SubID

00100010

patient name

Comments

00204000

REL Image Comments//Unaliased MB3/PE4/LB SENSE1

Operator

00081070

Station

00081010

unique scanner id

Project

00081030

ID Study Description//Brain^wpc-8620

SequenceName

0008103e

series description

SequenceType

00180024

ACQ Sequence Name

PED_major

00181312

ACQ Phase Encoding Direction ROW or COL

TR

00180080

TE

00180081

Matrix

00181310

ACQ Acquisition Matrix

PixelResol

00280030

IMG Pixel Spacing//2.29787230491642.2978723049164

BWP

00180095

ACQ Pixel Bandwidth (?) also unimplemented? need CSA value?

BWPPE

00191028

in matlab S.BandwidthPerPixelPhaseEncode;

FA

00181314

TA

0051100a

FoV

0051100c

eg FoV 1617*1727; but actually cocaluated from matrix and spacing?

Shims

ASCCOV

sAdjData.uiAdjShimModesGRADSPEC.asGPAData[0].lOffset{XYZ}sGRADSPEC.alShimCurrent[0:4]sTXSPEC.asNucleusInfo[0].lFrequency