VivoQuant 6.3.0
Loading...
Searching...
No Matches
BrainAtlasNaming Class Reference

Central naming rules for brain atlas files. More...

#include <BrainAtlasNaming.h>

Classes

struct  Parts
 Components extracted from an atlas filename. More...
 

Static Public Member Functions

static string rmhaName (string stem)
 Builds the canonical ROI atlas filename.
 
static string anatName (string stem, string modality)
 Builds the canonical anatomical header filename.
 
static string rawName (string stem, string modality)
 Builds the canonical anatomical raw image filename.
 
static string keyName (string stem, string keyType)
 Builds the canonical atlas key filename.
 
static string stemOf (string prefix, string animal)
 Constructs an atlas stem.
 
static string stripAtlasSuffix (string s)
 Removes a trailing "Atlas" suffix.
 
static bool isEncryptedPrefix (string stemOrName)
 Determines whether an atlas should be treated as encrypted.
 
static string prefixPattern ()
 Regular expression fragment matching a valid atlas prefix.
 
static string atlasSuffixPattern ()
 Regular expression fragment matching the mandatory "Atlas" suffix used by .rmha and key file names.
 

Detailed Description

Central naming rules for brain atlas files.

This class encapsulates all filename generation and parsing rules used by both built-in and custom atlases.

Canonical file layout

Given a stem consisting of:

<stem> = <prefix><animal>

Example stems:

invicroMouse
MyCustomRat
Mouse

the following filenames are generated:

<stem>Atlas.rmha
<stem>CT.mhd
<stem>CT.raw
<stem>Atlas-Key-AllRegions.csv

Scope

The active matching functions (used by SegmentationServiceNMCT to populate the atlas/animal combo boxes) only recognize names in the exact canonical form above – i.e. what CustomBrainAtlasWizard actually produces. Older files that omit the "Atlas" suffix or append a version tag after it (e.g. legacy invicroRatAtlas54.rmha) are not recognized; duplicate such files under a compliant name instead of relying on this class to parse them.

All filename creation functions produce the canonical naming format.

Member Function Documentation

◆ anatName()

static string anatName ( string  stem,
string  modality 
)
static

Builds the canonical anatomical header filename.

Parameters
stemAtlas stem.
modalityImaging modality (CT, MR, PET, etc.).
Returns
Filename of the form:
<stem><modality>.mhd

◆ atlasSuffixPattern()

static string atlasSuffixPattern ( )
static

Regular expression fragment matching the mandatory "Atlas" suffix used by .rmha and key file names.

This is required, not optional: CustomBrainAtlasWizard always appends "Atlas" (see createNewAtlasCompleteInputs()), so this class only recognizes names that include it. It intentionally does not match older names that omitted "Atlas" or appended a version tag after it (e.g. legacy invicroRatAtlas54.rmha) – such files should be duplicated under a compliant name rather than accepted here.

Only use this for .rmha/key filenames. Anatomical (.mhd) file names never contain "Atlas" at all (see anatName()) and must not use this pattern.

Returns
Regular expression fragment.

◆ isEncryptedPrefix()

static bool isEncryptedPrefix ( string  stemOrName)
static

Determines whether an atlas should be treated as encrypted.

Atlas names beginning with either "invicro" or "encrypted" are considered encrypted.

Comparison is case-insensitive.

Parameters
stemOrNameAtlas stem or filename.
Returns
True if the atlas is recognized as encrypted.

◆ keyName()

static string keyName ( string  stem,
string  keyType 
)
static

Builds the canonical atlas key filename.

Parameters
stemAtlas stem.
keyTypeKey type such as AllRegions or AllRegionsLeft.
Returns
Filename of the form:
<stem>Atlas-Key-<keyType>.csv

◆ prefixPattern()

static string prefixPattern ( )
static

Regular expression fragment matching a valid atlas prefix.

The pattern accepts letters, digits, underscores, periods, and hyphens.

This pattern is shared by all atlas discovery and parsing logic.

Returns
Regular expression fragment.

◆ rawName()

static string rawName ( string  stem,
string  modality 
)
static

Builds the canonical anatomical raw image filename.

Parameters
stemAtlas stem.
modalityImaging modality.
Returns
Filename of the form:
<stem><modality>.raw

◆ rmhaName()

static string rmhaName ( string  stem)
static

Builds the canonical ROI atlas filename.

Parameters
stemAtlas stem (<prefix><animal>).
Returns
Filename of the form:
<stem>Atlas.rmha

◆ stemOf()

static string stemOf ( string  prefix,
string  animal 
)
static

Constructs an atlas stem.

The stem is simply the concatenation of the prefix and animal name and does not include the "Atlas" suffix or modality.

Example:

stemOf("MyCustom", "Mouse")
-> "MyCustomMouse"
static string stemOf(string prefix, string animal)
Constructs an atlas stem.
Parameters
prefixOptional atlas prefix.
animalAnimal name.
Returns
Concatenated atlas stem.

◆ stripAtlasSuffix()

static string stripAtlasSuffix ( string  s)
static

Removes a trailing "Atlas" suffix.

If the supplied string ends with "Atlas", that suffix is removed. Otherwise the input is returned unchanged.

Parameters
sInput string.
Returns
String without a trailing "Atlas".