package ifc.bim.openecg.jtools.jparser; /** *

Title: SCP-ECG Section Header

*

Description: The structure of Section 0 with methods to parse data

*

Company: Ist. Fisiologia Clinica del CNR via G.Moruzzi,1 54124 Pisa Italy

* @authors Giacomo Ciani - Fabrizio Conforti (conforti@ifc.cnr.it) * @version 1.0 */ import java.io.*; import java.nio.*; import java.util.*; import java.util.logging.*; import javax.imageio.stream.*; /** * The structure of Section 0 with methods to parse data */ public class Sect000 extends SectGen { /** *The structure of a section pointer */ public class Pointer { /**Stores the section id*/ public int id; /**Stores the section length*/ public int len; /**Stores the section starting position*/ public int idx; /** *Constructs a Pointer */ public Pointer(){ id = readShort(); len = readInt(); idx = readInt(); } } /**Stores the sections' pointers*/ public Pointer[] ptrs; /** *Constructs a Sect0 with an anonymous logger */ public Sect000 () { this( Logger.getAnonymousLogger() ); } /** * Constructs a Sect0 that uses a specific logger * @param log the logger to be used */ public Sect000(Logger log){ this.log =log; head.sectCrc=0; head.sectId =0; head.sectLen=16; head.dataLen=0; head.sectVer=20; head.protVer=20; head.res ="SCPECG"; } /** * Parse the data part retrieving the value of single fields * @param lNum total number of leads stored in the SCP-ECG record (irrilevant for this section) * @throws Exception if any error occours during the operation */ public void Parse (int lNum) throws Exception{ try { ptrs = new Pointer[head.dataLen/10]; for(int i=0; i working[m2].idx) a[i+low].idx = working[m2++].idx; else a[i+low].idx = working[m1++].idx; else a[i+low].idx = working[m2++].idx; else a[i+low].idx = working[m1++].idx; } } /** to be completed ********************************** public void Test (){ log.info("*** Testing section 0 compliance with SCOP-ECG v2.0 *** /r/n"); if (head.sectVer<2.0) log.warning("SCP-ECG v2.0 compliance not declared! Declared section version is v"+(head.sectVer/10)+"."+(head.sectVer-(head.sectVer/10)*10)+"/r/n"); if (head.sectId!=0) log.warning("wrong Section Id declared! Expected 0, found "+head.sectId+"/r/n"); if (head.dataLen!=ptrs.length*10) log.warning("wrong Lenght declared! Expected "+(ptrs.length*10)+", found "+head.dataLen+"/r/n"); if (head.res!="SCPECG") log.warning("reserved field in header not filled with string SCPECG as requested /r/n"); String miss = "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11"; for (int i=0; i