Exemplo n.º 1
0
        public static void CalculateXYCoincidenceFromIJ(PETDigitalCoincidence In, ref PETCoincidence Out)
        {
            Out.Position1 = In.Position1;
            Out.Position2 = In.Position2;
            Out.Timestamp = In.Timestamp;

            GetXYFromIJ(In.I1, In.J1, 511.0, out Out.XPlus1, out Out.XMinus1, out Out.YPlus1, out Out.YMinus1);
            GetXYFromIJ(In.I1, In.J1, 511.0, out Out.XPlus2, out Out.XMinus2, out Out.YPlus2, out Out.YMinus2);
        }
Exemplo n.º 2
0
        public static PETDigitalCoincidence[] ConvertXYToIJCoincidences(PETCoincidence[] coinc)
        {
            var res = new PETDigitalCoincidence[coinc.Length];

            for (int i = 0; i < res.Length; i++)
            {
                CalculateDigitalCoincidence(coinc[i], ref res[i]);
            }

            return(res);
        }
Exemplo n.º 3
0
        public static void CalculateDigitalCoincidence(PETCoincidence In, ref PETDigitalCoincidence OutE)
        {
            OutE.I1 = (byte)iForX(In.XPlus1, In.XMinus1);
            OutE.J1 = (byte)jForY(In.YPlus1, In.YMinus1);

            OutE.I2 = (byte)iForX(In.XPlus2, In.XMinus2);
            OutE.J2 = (byte)jForY(In.YPlus2, In.YMinus2);

            OutE.Position1 = In.Position1;
            OutE.Position2 = In.Position2;

            OutE.Timestamp = In.Timestamp;

            // OutE.Flags = In.Flags;
        }
Exemplo n.º 4
0
        public static PETDigitalCoincidence FromBytes(byte[] b, int Ofs)
        {
            var res = new PETDigitalCoincidence();

            res.Timestamp = BitConverter.ToUInt32(b, Ofs + 0);
            res.Position1 = BitConverter.ToUInt16(b, Ofs + 4);
            res.Position2 = BitConverter.ToUInt16(b, Ofs + 6);

            res.I1 = b[Ofs + 8];
            res.J1 = b[Ofs + 9];
            res.I2 = b[Ofs + 10];
            res.J2 = b[Ofs + 11];

            return(res);
        }
Exemplo n.º 5
0
        public static PETDigitalCoincidence[] DecodeArray(byte[] b, int Ofs, int Len)
        {
            int ofs = Ofs;

            var res = new List <PETDigitalCoincidence>();

            int num = Len / PETStructSizes.PETDigitalCoincidence_Size;

            for (int i = 0; i < num; i++)
            {
                var coi = PETDigitalCoincidence.FromBytes(b, ofs);
                res.Add(coi);

                ofs += PETStructSizes.PETDigitalCoincidence_Size;
            }

            return(res.ToArray());
        }
Exemplo n.º 6
0
        public static void CalculateCoincidenceForDigital(PETDigitalCoincidence In, ref PETCoincidence OutE)
        {
            OutE.XPlus1  = XPlusForI(In.I1);
            OutE.XMinus1 = XMinusForI(In.I1);
            OutE.XPlus2  = XPlusForI(In.I2);
            OutE.XMinus2 = XMinusForI(In.I2);

            OutE.YPlus1  = YPlusForJ(In.J1);
            OutE.YMinus1 = YMinusForJ(In.J1);
            OutE.YPlus2  = YPlusForJ(In.J2);
            OutE.YMinus2 = YMinusForJ(In.J2);

            OutE.Position1 = In.Position1;
            OutE.Position2 = In.Position2;

            OutE.Timestamp = In.Timestamp;

            // OutE.Flags = In.Flags;
        }