nrrd.js
function parseField(identifier, descriptor) {
    switch(identifier) {
    // Literal (uninterpreted) fields
    case 'content':
    case 'number':
    case 'sampleUnits':
        break;
    // Integers
    case 'dimension':
    case 'blockSize':
    case 'lineSkip':
    case 'byteSkip':
    case 'spaceDimension':
        descriptor = parseNRRDInteger(descriptor);
        break;
    // Floats
    case 'min':
    case 'max':
    case 'oldMin':
    case 'oldMax':
        descriptor = parseNRRDFloat(descriptor);
        break;
    // Vectors
    case 'spaceOrigin':
        descriptor = parseNRRDVector(descriptor);
        break;
    // Lists of strings
    case 'labels':
    case 'units':
    case 'spaceUnits':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDQuotedString);
        break;
    // Lists of integers
    case 'sizes':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDInteger);
        break;
    // Lists of floats
    case 'spacings':
    case 'thicknesses':
    case 'axisMins':
    case 'axisMaxs':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDFloat);
        break;
    // Lists of vectors
    case 'spaceDirections':
    case 'measurementFrame':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDVector);
        break;
    // One-of-a-kind fields
    case 'type':
        descriptor = parseNRRDType(descriptor);
        break;
    case 'encoding':
        descriptor = parseNRRDEncoding(descriptor);
        break;
    case 'endian':
        descriptor = parseNRRDEndian(descriptor);
        break;
    case 'dataFile':
        descriptor = parseNRRDDataFile(descriptor);
        break;
    case 'centers':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDCenter);
        break;
    case 'kinds':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDKind);
        break;
    case 'space':
        descriptor = parseNRRDSpace(descriptor);
        break;
    // Something unknown
    default:
        console.warn("Unrecognized NRRD field: " + identifier);
    }
    return descriptor;
}
function parseField(identifier, descriptor) {
    switch(identifier) {
    // Literal (uninterpreted) fields
    case 'content':
    case 'number':
    case 'sampleUnits':
        break;
    // Integers
    case 'dimension':
    case 'blockSize':
    case 'lineSkip':
    case 'byteSkip':
    case 'spaceDimension':
        descriptor = parseNRRDInteger(descriptor);
        break;
    // Floats
    case 'min':
    case 'max':
    case 'oldMin':
    case 'oldMax':
        descriptor = parseNRRDFloat(descriptor);
        break;
    // Vectors
    case 'spaceOrigin':
        descriptor = parseNRRDVector(descriptor);
        break;
    // Lists of strings
    case 'labels':
    case 'units':
    case 'spaceUnits':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDQuotedString);
        break;
    // Lists of integers
    case 'sizes':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDInteger);
        break;
    // Lists of floats
    case 'spacings':
    case 'thicknesses':
    case 'axisMins':
    case 'axisMaxs':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDFloat);
        break;
    // Lists of vectors
    case 'spaceDirections':
    case 'measurementFrame':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDVector);
        break;
    // One-of-a-kind fields
    case 'type':
        descriptor = parseNRRDType(descriptor);
        break;
    case 'encoding':
        descriptor = parseNRRDEncoding(descriptor);
        break;
    case 'endian':
        descriptor = parseNRRDEndian(descriptor);
        break;
    case 'dataFile':
        descriptor = parseNRRDDataFile(descriptor);
        break;
    case 'centers':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDCenter);
        break;
    case 'kinds':
        descriptor = parseNRRDWhitespaceSeparatedList(descriptor, parseNRRDKind);
        break;
    case 'space':
        descriptor = parseNRRDSpace(descriptor);
        break;
    // Something unknown
    default:
        console.warn("Unrecognized NRRD field: " + identifier);
    }
    return descriptor;
}
function parseField ( identifier , descriptor ) { switch ( identifier ) { // Literal (uninterpreted) fields case 'content' : case 'number' : case 'sampleUnits' : break ; // Integers case 'dimension' : case 'blockSize' : case 'lineSkip' : case 'byteSkip' : case 'spaceDimension' : descriptor = parseNRRDInteger ( descriptor ) ; break ; // Floats case 'min' : case 'max' : case 'oldMin' : case 'oldMax' : descriptor = parseNRRDFloat ( descriptor ) ; break ; // Vectors case 'spaceOrigin' : descriptor = parseNRRDVector ( descriptor ) ; break ; // Lists of strings case 'labels' : case 'units' : case 'spaceUnits' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDQuotedString ) ; break ; // Lists of integers case 'sizes' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDInteger ) ; break ; // Lists of floats case 'spacings' : case 'thicknesses' : case 'axisMins' : case 'axisMaxs' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDFloat ) ; break ; // Lists of vectors case 'spaceDirections' : case 'measurementFrame' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDVector ) ; break ; // One-of-a-kind fields case 'type' : descriptor = parseNRRDType ( descriptor ) ; break ; case 'encoding' : descriptor = parseNRRDEncoding ( descriptor ) ; break ; case 'endian' : descriptor = parseNRRDEndian ( descriptor ) ; break ; case 'dataFile' : descriptor = parseNRRDDataFile ( descriptor ) ; break ; case 'centers' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDCenter ) ; break ; case 'kinds' : descriptor = parseNRRDWhitespaceSeparatedList ( descriptor , parseNRRDKind ) ; break ; case 'space' : descriptor = parseNRRDSpace ( descriptor ) ; break ; // Something unknown default : console . warn ( "Unrecognized NRRD field: " + identifier ) ; } return descriptor ; }
Parses and normalizes NRRD fields, assumes the field names are already lower case.
Parses and normalizes NRRD fields assumes the field names are already lower case .