Skip to content
Snippets Groups Projects
globals.ts 2.48 KiB
Newer Older
export interface coordinates
  x: number;
  y: number;
Francesco Giacomini's avatar
Francesco Giacomini committed
export class Calibration
{
  a: number;
  b: number;
}

export enum ReadDirection {
  u,// lettura non definita
  r,//lettura per righe
  c//lettura per colonne
}
export class Metadata
{
  private static _instance: Metadata = new Metadata();
  private constructor() {
    if(Metadata._instance) {
      throw new Error("Error: Image object is already instantiated");
    }
    else {
      Metadata._instance = this;
    }
  }
  xMin: number = 0;
  xMax: number = 0;
  yMin: number = 0;
  yMax: number = 0;
  step: number = 0;
  direction: ReadDirection = ReadDirection.u;

  public static getInstance(): Metadata {
    return Metadata._instance;
  }
Francesco Giacomini's avatar
Francesco Giacomini committed
export class Image
{
  private static _instance: Image = new Image();
  private constructor() {
    if(Image._instance)
    {
      throw new Error ("Error: Image object is already instantiated");
    } 
    else
    {
      Image._instance = this;
    }
  }
Francesco Giacomini's avatar
Francesco Giacomini committed
  DataMatrix: number[][][];
  width: number;
  height: number;
  readonly calibration: Calibration = {a: 3.36275, b: 58.2353};
  readonly depth: number = 8000;
  readonly maxCoordValueX = 60000000;
  readonly headerSetValue = 17000;
  readonly xCoordHeaderFirstValue = 5; //instestazione X
  readonly yCoordHeaderFirstValue = 6; //intestazione y
  channelDepth: number = require("./helper").round3(((this.depth + 1) * this.calibration.a - this.calibration.b) / 1000); //profondità massima in canali
  globalxMinRange: number = 0;
  globalxMaxRange: number = this.channelDepth;
  zPixel1: coordinates;
  zPixel2: coordinates; //pixel2 dello zoom
  newOrigin: coordinates = { x: 0, y: 0}; //nuovo origine nel caso di zoom
  maxAbsolute: number; //massimo conteggio della matrice nOfCounts
  pixelDim: number; //dimensione dei pixel responsive
  nOfCounts: number[][]; //matrici con i dati
  rePrint: boolean = false; //variabile per ricolorare con il max relativo
  public static getInstance(): Image
  {
    return Image._instance;
export class Chart {
  private static _instance: Chart = new Chart();
  private constructor()
  {
    if(Chart._instance)
    {
      throw new Error("Error: Image object is already instantiated");
    } 
    else 
    {
      Chart._instance = this;
  dataCompleteChart: string = "Channel,Counts\n";
  dataCompleteChartCalibrated: string = "Energy,Counts\n";
  calibrated: boolean = false; //variabile per il controllo sulla calibrazione
  public static getInstance(): Chart
  {
    return Chart._instance;