It is a color scheme for visualising SPM scans.
This page hosts a formal specification of NT-MDT palette format using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
All JavaScript code generated by Kaitai Struct depends on the Kaitai Struct runtime library for JavaScript. You must add this dependency to your project before you can parse or serialize any data.
The JavaScript runtime library is available at npm:
npm install kaitai-struct
See the usage examples in the JavaScript notes.
Parse structure from an ArrayBuffer:
var arrayBuffer = ...;
var data = new NtMdtPal(new KaitaiStream(arrayBuffer));
After that, one can get various attributes from the structure by accessing fields or properties like:
data.signature // => get signature
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports', 'kaitai-struct/KaitaiStream'], factory);
} else if (typeof exports === 'object' && exports !== null && typeof exports.nodeType !== 'number') {
factory(exports, require('kaitai-struct/KaitaiStream'));
} else {
factory(root.NtMdtPal || (root.NtMdtPal = {}), root.KaitaiStream);
}
})(typeof self !== 'undefined' ? self : this, function (NtMdtPal_, KaitaiStream) {
/**
* It is a color scheme for visualising SPM scans.
*/
var NtMdtPal = (function() {
function NtMdtPal(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
NtMdtPal.prototype._read = function() {
this.signature = this._io.readBytes(26);
if (!((KaitaiStream.byteArrayCompare(this.signature, new Uint8Array([78, 84, 45, 77, 68, 84, 32, 80, 97, 108, 101, 116, 116, 101, 32, 70, 105, 108, 101, 32, 32, 49, 46, 48, 48, 33])) == 0))) {
throw new KaitaiStream.ValidationNotEqualError(new Uint8Array([78, 84, 45, 77, 68, 84, 32, 80, 97, 108, 101, 116, 116, 101, 32, 70, 105, 108, 101, 32, 32, 49, 46, 48, 48, 33]), this.signature, this._io, "/seq/0");
}
this.count = this._io.readU4be();
this.meta = [];
for (var i = 0; i < this.count; i++) {
this.meta.push(new Meta(this._io, this, this._root));
}
this.something2 = this._io.readBytes(1);
this.tables = [];
for (var i = 0; i < this.count; i++) {
this.tables.push(new ColTable(this._io, this, this._root, i));
}
}
var ColTable = NtMdtPal.ColTable = (function() {
function ColTable(_io, _parent, _root, index) {
this._io = _io;
this._parent = _parent;
this._root = _root;
this.index = index;
this._read();
}
ColTable.prototype._read = function() {
this.size1 = this._io.readU1();
this.unkn = this._io.readU1();
this.title = KaitaiStream.bytesToStr(this._io.readBytes(this._root.meta[this.index].nameSize), "UTF-16LE");
this.unkn1 = this._io.readU2be();
this.colors = [];
for (var i = 0; i < this._root.meta[this.index].colorsCount - 1; i++) {
this.colors.push(new Color(this._io, this, this._root));
}
}
return ColTable;
})();
var Color = NtMdtPal.Color = (function() {
function Color(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root;
this._read();
}
Color.prototype._read = function() {
this.red = this._io.readU1();
this.unkn = this._io.readU1();
this.blue = this._io.readU1();
this.green = this._io.readU1();
}
return Color;
})();
var Meta = NtMdtPal.Meta = (function() {
function Meta(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root;
this._read();
}
Meta.prototype._read = function() {
this.unkn00 = this._io.readBytes(3);
this.unkn01 = this._io.readBytes(2);
this.unkn02 = this._io.readBytes(1);
this.unkn03 = this._io.readBytes(1);
this.colorsCount = this._io.readU2le();
this.unkn10 = this._io.readBytes(2);
this.unkn11 = this._io.readBytes(1);
this.unkn12 = this._io.readBytes(2);
this.nameSize = this._io.readU2be();
}
/**
* usually 0s
*/
/**
* usually 0s
*/
/**
* usually 0s
*/
/**
* usually 4
*/
/**
* usually 0s
*/
return Meta;
})();
return NtMdtPal;
})();
NtMdtPal_.NtMdtPal = NtMdtPal;
});