Reference

The classifier

How a scan decides what each MRI series is, from how it was acquired, and the evidence it weighs for every name. Every number and every rule here can be changed.

What it does

A series name is typed by a person at the scanner and can be wrong; dcm2niix, the converter BIDS Manager uses for DICOM, guesses a BIDS name from a few strings in the header, and is wrong in ways that repeat: a contrast-enhanced T1w named as a plain T1w, ASL and its M0 scan confused, maps the scanner computed converted as data. The classifier names each MRI series from how it was acquired instead, and uses dcm2niix's guess as a second opinion. How names are decided shows three real series judged all three ways, and where the classifier sits in the order of the scan's steps.

On 256 series checked by hand, from scanners of several vendors, it named 99.2 % right, against 89.1 % with the classifier off (dcm2niix's guess, the name patterns and the scan rules).

It names MR images only. Spectroscopy, PET and CT keep the names the other steps give them, and it never replaces a name in a datatype its rules do not cover.

Where the idea comes from

Naming MRI series from their acquisition parameters is not new: dcm2niix's guess and earlier tools do it too. Part of the inspiration for BIDS Manager's classifier came from SWIFTCAT, a tool that converts mostly anatomical MRI to BIDS from acquisition parameters, developed by Marta Loureiro, Rita G. Nunes and Rita Reis Nunes (Evolutionary Systems and Biomedical Engineering Lab, LaSEEB, University of Lisbon) and Patricia Clement (Department of Medical Imaging, Ghent University Hospital, UZ Gent).

BIDS Manager's classifier is its own early implementation of this idea. It works well overall, and every name it gives can be checked and changed (Seeing why). The SWIFTCAT team is putting a lot of effort into improving the approach for MRI, testing it on clinical and heterogeneous data. SWIFTCAT is not public yet: stay tuned for its release, which could also be plugged into BIDS Manager as a classification algorithm.

How a series is named

  1. Each series is scored alone. The scan reads the series' acquisition parameters from its DICOM header (echo, repetition and inversion times, flip angle, readout, number of volumes, b-values, phase encoding, a contrast agent, the ASL protocol, and the vendor's private fields where they say more). Each piece of evidence for or against a name adds its weight to that name's score, and the scores become a confidence between 0 and 1.
  2. The session is looked at as a whole. A single-band reference sits immediately before its run with the same geometry; a few-volume EPI with the opposite phase encoding of a run is that run's fieldmap; two inversions of one gradient echo are an MP2RAGE; a phase series beside its magnitude twin is the same run's part-phase. These add evidence, and entities (dir, inv, part).
  3. The name is decided, against dcm2niix's guess:
When The name used
Both agree that name, confirmed
The classifier is sure (confidence at or above Name without asking above, 0.8) and they differ the classifier's, and the row says what dcm2niix suggested
The classifier is unsure (between the two thresholds) the one the series name agrees with, and the row is marked to check
The classifier has no opinion (below Leave to the other opinions below, 0.4) the name the other steps gave (dcm2niix's guess, a scan rule without Force, or the series name), marked to check

A forced scan rule (Settings > Scan rules) wins over all of this during a scan. Naming a table again later (below) does not know which rows a rule or a hand edit named, and can rename them.

Seeing why

The confidence column of the Table view shows how sure the classifier was. Select a row and scroll Properties to Why this name: the evidence for and against the name, and the other names it considered with their confidence. Naming recordings goes through it on the course's sample.

Switching it off

Settings > Classification > Use the acquisition parameters:

Choice What happens
To name the series (default) as above
Only to report the names come from the other steps (your scan rules, dcm2niix's guess, the series name), as before 1.5.0; the classifier's verdict is recorded and shown, but not used
Not at all the classifier does not run

The same from the command line: bidsmgr-scan --classifier applied|shadow|off.

The settings

Every number the classifier tests is a setting: the two thresholds, the weight of each kind of evidence (parameters, series name, neighbouring series), and the ranges that tell contrasts apart (the inversion time of an MPRAGE, the echo time of a T2-weighted image, the number of volumes of a BOLD run, and so on). They are listed, with their ranges and defaults, under Classification in Settings.

From the command line, the same settings are a JSON file:

Terminal
bidsmgr-scan --print-classifier-config > classifier.json
bidsmgr-scan /data/raw/my_study inventory.tsv --classifier-config classifier.json
bidsmgr-classify inventory.tsv --config classifier.json --json

bidsmgr-classify names the series of an existing inventory.tsv again from the features the scan cached, without reading any DICOM, so you can try a setting on a whole study in seconds. --apply writes the new names into inventory.tsv, including over names a forced scan rule or a hand edit gave: check those rows afterwards.

The rules

What counts as evidence for each name is a file of rules, the rulebook. Each line is one piece of evidence: a feature of the acquisition or a word in the series name, a test, a weight (positive for the name, negative against), and the sentence Why this name shows. Ranges named after a setting take their values from the settings above.

Settings > Classification has Export the rules... and Load rules...: export the rulebook, change a weight or add a piece of evidence in the file, and load it back. Only what differs from the shipped rules is kept with your settings, so a later version of BIDS Manager still brings its own improvements to the rest.

The shipped rules

The rules of BIDS Manager 1.5.0, name by name. Names under exclude/ are what the classifier says should not be converted.

T1-weighted anat/T1w

EvidenceFromWeight
not an EPI readoutParameters+0.5
an inversion-recovery gradient echo (MPRAGE-like)Parameters+3.5
a spin echo with a short echo and repetition timeParameters+3
a gradient echo with a short echo, a short repetition time and a large flip angleParameters+2.5
a magnetisation-transfer pulse before a short echo (MT-weighted T1, as for neuromelanin)Parameters+1
a fast 3-D spoiled gradient echoParameters+1.5
more than one volumeParameters-2
a derived imageParameters-3
a long inversion (FLAIR)Parameters-3
one inversion of an MP2RAGEParameters-2.5
the name says T1Series name+2.5
the name says another contrastSeries name-1.5
a magnetization-prepared 3-D gradient echo (MPRAGE)Parameters+1
a high-resolution 3-D acquisitionParameters+0.5
a time-of-flight angiogramParameters-2.5

T2-weighted anat/T2w

EvidenceFromWeight
a spin echo with a long repetition time and an echo of {value} msParameters+3.5
an EPI readoutParameters-3
a long inversion (FLAIR)Parameters-3.5
a gradient echo, not a spin echoParameters-2
more than one volumeParameters-2
read at many echo timesParameters-2
a derived imageParameters-3
the name says T2Series name+2.5
the name says another contrastSeries name-1.5
a turbo spin echoParameters+0.5
a high-resolution 3-D acquisitionParameters+0.5

FLAIR anat/FLAIR

EvidenceFromWeight
an inversion long enough to null the fluidParameters+4
an EPI readoutParameters-3
more than one volumeParameters-2
a derived imageParameters-3
the name says FLAIRSeries name+3
a turbo spin echoParameters+0.5
a high-resolution 3-D acquisitionParameters+0.5

Proton density weighted anat/PDw

EvidenceFromWeight
a spin echo with a long repetition time and a short echo ({value} ms)Parameters+3
an EPI readoutParameters-3
more than one volumeParameters-2
the name says proton densitySeries name+3
a turbo spin echoParameters+0.5

T2*-weighted anat/T2starw

EvidenceFromWeight
a single long gradient echoParameters+3
an EPI readoutParameters-3
more than one volumeParameters-2
a magnetisation-transfer pulseParameters-2
the name says T2*Series name+2.5

Multi-echo gradient echo anat/MEGRE

EvidenceFromWeight
a gradient echo with three or more echoesParameters+3.5
an EPI readoutParameters-3
read at one or two echo timesParameters-2
the name says multi-echoSeries name+2

Multi-echo spin echo anat/MESE

EvidenceFromWeight
a spin echo with three or more echoesParameters+3.5
an EPI readoutParameters-3
the name says multi-echo spin echoSeries name+2

MP2RAGE inversion anat/MP2RAGE

EvidenceFromWeight
one of two inversions read by a 3-D gradient echoParameters+3.5
a derived imageParameters-3
the name says MP2RAGESeries name+2.5

MP2RAGE uniform image anat/UNIT1

EvidenceFromWeight
the scanner's uniform (UNI) imageParameters+5
the name says UNISeries name+2.5

T1 map anat/T1map

EvidenceFromWeight
the scanner's T1 mapParameters+5
the name says T1 mapSeries name+2.5

Angiography anat/angio

EvidenceFromWeight
an EPI readoutParameters-3
the name says angiographySeries name+3.5
a flow-compensated 3-D gradient echo with a short repetition and a moderate flip angle: time of flightParameters+4
computed by the scanner (a projection)Parameters-3

BOLD run func/bold

EvidenceFromWeight
an EPI readoutParameters+2
a time series of {value} volumesParameters+3
only {value} volumes: a reference, not a runParameters-3
diffusion weightingParameters-6
slice times recordedParameters+0.5
the name says BOLDSeries name+2
the name says SBRefSeries name-3
the name says referenceSeries name-1.5
the name says diffusionSeries name-3
an echo time of {value} ms, typical of BOLDParameters+1
repeats every {value} sParameters+0.5
acquired during a contrast bolusParameters-5
the protocol labels arterial blood (ASL)Parameters-5
the scanner marks it ASLParameters-4
the scanner marks it PERFUSIONParameters-3

Single-band reference func/sbref

EvidenceFromWeight
a single EPI volumeParameters+1.5
more than one volumeParameters-3
diffusion weightingParameters-3
a b=0 diffusion volumeParameters-1.5
the name says SBRefSeries name+4

Diffusion dwi/dwi

EvidenceFromWeight
b-values up to {value} s/mm²Parameters+4
{value} gradient directionsParameters+2
an EPI readoutParameters+1
a derived image (a map)Parameters-3
a single volumeParameters-1
the name says diffusionSeries name+2.5
the name says SBRefSeries name-3

Diffusion single-band reference dwi/sbref

EvidenceFromWeight
a single EPI volumeParameters+1
more than one volumeParameters-3
the name says SBRefSeries name+3
the name says diffusionSeries name+1

Fieldmap magnitude (two echoes) fmap/magnitude1

EvidenceFromWeight
a gradient echo read at two echo timesParameters+4
a magnitude imageParameters+0.5
an EPI readoutParameters-3
the name says fieldmapSeries name+2.5

Fieldmap magnitude (beside a map in Hz) fmap/magnitude

EvidenceFromWeight
read at two echo times: the magnitudes of a phase differenceParameters-2
a magnitude imageParameters+0.5
an EPI readoutParameters-3
the name says fieldmapSeries name+2

Fieldmap phase difference fmap/phasediff

EvidenceFromWeight
the phase of a two-echo gradient echoParameters+4
an EPI readoutParameters-3
the name says fieldmapSeries name+2

Fieldmap (Hz) fmap/fieldmap

EvidenceFromWeight
a single-echo phase image of a gradient echoParameters+2
an EPI readoutParameters-3
the name says B0 mapSeries name+2.5

Reversed-phase EPI reference fmap/epi

EvidenceFromWeight
an EPI readoutParameters+2
a few volumes ({value})Parameters+1
only b=0 volumes: a reference for distortion correctionParameters+2.5
diffusion weightingParameters-2
the name says referenceSeries name+2.5
the name says SBRefSeries name-2.5

Arterial spin labelling perf/asl

EvidenceFromWeight
several volumesParameters+0.5
the name says ASLSeries name+4.5
the protocol labels arterial blood (pulsed or pseudo-continuous)Parameters+4
the scanner marks it ASLParameters+3
computed by the scanner (a subtraction or CBF map)Parameters-3
the name says perfusionSeries name+1
the name says M0Series name-4
one or two volumes: an M0 reference, not label and control pairsParameters-1.5
a map computed from the ASL series, not the seriesParameters-6

ASL M0 perf/m0scan

EvidenceFromWeight
the name says M0Series name+5
an unlabelled ASL readout of one or two volumesParameters+1.5
labelled arterial blood over many volumes: the ASL seriesParameters-3
computed by the scannerParameters-3
a map computed from the ASL series, not the seriesParameters-6

Contrast bolus (DSC perfusion) exclude/dsc

EvidenceFromWeight
an EPI time series acquired during a contrast bolusParameters+5
the scanner marks it PERFUSIONParameters+2
computed by the scanner (a perfusion map)Parameters-3
the name says perfusion or bolusSeries name+1.5

Localizer (left out) exclude/localizer

EvidenceFromWeight
{value} slice orientations in one seriesParameters+5
only a few slicesParameters+1
the name says localizerSeries name+4
a high-resolution 3-D seriesParameters-2

Derived or reformatted (left out) exclude/derived

EvidenceFromWeight
a reformat or projection the scanner computedParameters+5
a derived imageParameters+1
the name says reformatSeries name+2
the name says maskSeries name+4
a map the scanner computed from a perfusion series (subtraction, CBF)Parameters+5