示例#1
0
        private List<ViewObject> GetImageData()
        {
            List<ViewObject> ret = new List<ViewObject>();

            MemoryStream tipMS = null;

            bool injectTIP = false;

            TIPStatus tipStatus;

            if (m_CaseObj.caseType == CaseType.FTICase)
            {
                DataAttachment ftiAttachment = null;
                foreach (DataAttachment attachment in m_CaseObj.attachments.GetFTIImageAttachments())
                {
                    tipMS = attachment.attachmentData;
                    injectTIP = true;
                    ftiAttachment = attachment;
                    break;
                }

                m_CaseObj.attachments.Remove(ftiAttachment);
            }

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetXrayImageAttachments())
            {
                MemoryStream ms = attachment.attachmentData;

                System.Windows.Rect view0Rect = new System.Windows.Rect();
                System.Windows.Rect view1Rect = new System.Windows.Rect();

                if (injectTIP)
                {
                    tipStatus = new TIPStatus();

                    _PxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;
                        m_DisplayFTIError = true;
                    }
                    else
                    {
                        view0Rect = new System.Windows.Rect(new Point((double)tipStatus.injectLocation_view0.left,
                                                       (double)tipStatus.injectLocation_view0.top),
                                             new Point((double)tipStatus.injectLocation_view0.right,
                                                       (double)tipStatus.injectLocation_view0.bottom));

                        view1Rect = new System.Windows.Rect(new Point((double)tipStatus.injectLocation_view1.left,
                                                       (double)tipStatus.injectLocation_view1.top),
                                             new Point((double)tipStatus.injectLocation_view1.right,
                                                       (double)tipStatus.injectLocation_view1.bottom));
                    }
                }
                else
                {
                    _PxeAccess.OpenPXEImageFromMemory(ms);
                }

                if (_PxeAccess.GetPxeHeader().sequenceNum != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.container == null)
                    {
                        m_CaseObj.scanInfo.container = new Container();
                    }

                    m_CaseObj.scanInfo.container.SequenceNum = _PxeAccess.GetPxeHeader().sequenceNum.ToString();
                }

                if (_PxeAccess.GetPxeHeader().batchNumber != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.conveyance == null)
                    {
                        m_CaseObj.scanInfo.conveyance = new Conveyance();
                    }

                    m_CaseObj.scanInfo.conveyance.BatchNum = _PxeAccess.GetPxeHeader().batchNumber.ToString();
                }

                if (_PxeAccess.GetPxeHeader().viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)_PxeAccess.GetPxeHeader().viewBuffer_0.width;
                    int height = (int)_PxeAccess.GetPxeHeader().viewBuffer_0.height;

                    if (_PxeAccess.GetPxeHeader().viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View0",
                                                        _PxeAccess.GetPxeHeader().pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        _PxeAccess.GetPxeHeader().detectorsPerBoard,
                                                        _PxeAccess.GetPxeHeader().bitsPerPixel,
                                                        _PxeAccess.GetPxeHeader().samplingSpeed,
                                                        _PxeAccess.GetPxeHeader().samplingSpace,
                                                        GetAnnotationsForView("View0"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<System.Windows.Rect>();
                        viewObj.TIPMarkings.Add(view0Rect);
                    }

                    ret.Add(viewObj);
                }

                if (_PxeAccess.GetPxeHeader().viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)_PxeAccess.GetPxeHeader().viewBuffer_1.width;
                    int height = (int)_PxeAccess.GetPxeHeader().viewBuffer_1.height;

                    if (_PxeAccess.GetPxeHeader().viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View1",
                                                        _PxeAccess.GetPxeHeader().pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        _PxeAccess.GetPxeHeader().detectorsPerBoard,
                                                        _PxeAccess.GetPxeHeader().bitsPerPixel,
                                                        _PxeAccess.GetPxeHeader().samplingSpeed,
                                                        _PxeAccess.GetPxeHeader().samplingSpace,
                                                        GetAnnotationsForView("View1"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<System.Windows.Rect>();
                        viewObj.TIPMarkings.Add(view1Rect);
                    }

                    ret.Add(viewObj);
                }
            }

            return ret;
        }
示例#2
0
        public bool OpenPXEImageFromMemoryWithTIP(MemoryStream pxeFile, MemoryStream tipPXEFile, ref TIPStatus tipStatus)
        {
            byte[] pxeData = new byte[pxeFile.Length];

            using (BinaryReader r = new BinaryReader(pxeFile))
            {
                // Read data from Test.data.
                pxeData = r.ReadBytes((int)pxeFile.Length);
            }

            buffersAvailable.Clear();

            byte[] tipPXEData = new byte[tipPXEFile.Length];

            using (BinaryReader r = new BinaryReader(tipPXEFile))
            {
                // Read data from Test.data.
                tipPXEData = r.ReadBytes((int)tipPXEFile.Length);
            }

            buffersAvailable.Clear();

            pxeHeader = OpenAndProcessPXEImageFromMemoryWithTIP(_InstanceId, pxeData, (int)pxeData.Length, tipPXEData, (int)tipPXEData.Length, ref tipStatus);

            if (pxeHeader.isValidFile != 1)
            {
                CloseActiveBag(_InstanceId);
                return false;
            }

            LoadPXEData();

            tipPXEFile.Close();
            tipPXEFile.Dispose();

            pxeFile.Close();
            pxeFile.Dispose();

            return true;
        }
示例#3
0
 public static extern PXEHeader OpenAndProcessPXEImageFromMemoryWithTIP (uint instance, byte[] pxeData, int memSize, byte[] tipPXEData, int tipDataMemSize, ref TIPStatus ts);
示例#4
0
        public bool OpenPXEImageFromMemoryWithTIP(MemoryStream pxeFile, MemoryStream tipPXEFile, ref TIPStatus tipStatus)
        {
            byte[] pxeData = new byte[pxeFile.Length];

            using (BinaryReader r = new BinaryReader(pxeFile))
            {
                // Read data from Test.data.
                pxeData = r.ReadBytes((int)pxeFile.Length);
            }

            buffersAvailable.Clear();

            byte[] tipPXEData = new byte[tipPXEFile.Length];

            using (BinaryReader r = new BinaryReader(tipPXEFile))
            {
                // Read data from Test.data.
                tipPXEData = r.ReadBytes((int)tipPXEFile.Length);
            }

            buffersAvailable.Clear();

            pxeHeader = OpenAndProcessPXEImageFromMemoryWithTIP(_InstanceId, pxeData, (int)pxeData.Length, tipPXEData, (int)tipPXEData.Length, ref tipStatus);

            if (pxeHeader.isValidFile != 1)
            {
                CloseActiveBag(_InstanceId);
                return(false);
            }

            LoadPXEData();

            tipPXEFile.Close();
            tipPXEFile.Dispose();

            pxeFile.Close();
            pxeFile.Dispose();

            return(true);
        }
示例#5
0
 public static extern PXEHeader OpenAndProcessPXEImageFromMemoryWithTIP(uint instance, byte[] pxeData, int memSize, byte[] tipPXEData, int tipDataMemSize, ref TIPStatus ts);
示例#6
0
        private List <ViewObject> GetImageData()
        {
            List <ViewObject> ret = new List <ViewObject>();

            MemoryStream tipMS = null;

            bool injectTIP = false;

            TIPStatus tipStatus;

            if (m_CaseObj.caseType == CaseType.FTICase)
            {
                DataAttachment ftiAttachment = null;
                foreach (DataAttachment attachment in m_CaseObj.attachments.GetFTIImageAttachments())
                {
                    tipMS         = attachment.attachmentData;
                    injectTIP     = true;
                    ftiAttachment = attachment;
                    break;
                }

                m_CaseObj.attachments.Remove(ftiAttachment);
            }

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetXrayImageAttachments())
            {
                MemoryStream ms = attachment.attachmentData;

                System.Windows.Rect view0Rect = new System.Windows.Rect();
                System.Windows.Rect view1Rect = new System.Windows.Rect();

                if (injectTIP)
                {
                    tipStatus = new TIPStatus();

                    _PxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;
                        m_DisplayFTIError = true;
                    }
                    else
                    {
                        view0Rect = new System.Windows.Rect(new Point((double)tipStatus.injectLocation_view0.left,
                                                                      (double)tipStatus.injectLocation_view0.top),
                                                            new Point((double)tipStatus.injectLocation_view0.right,
                                                                      (double)tipStatus.injectLocation_view0.bottom));

                        view1Rect = new System.Windows.Rect(new Point((double)tipStatus.injectLocation_view1.left,
                                                                      (double)tipStatus.injectLocation_view1.top),
                                                            new Point((double)tipStatus.injectLocation_view1.right,
                                                                      (double)tipStatus.injectLocation_view1.bottom));
                    }
                }
                else
                {
                    _PxeAccess.OpenPXEImageFromMemory(ms);
                }

                if (_PxeAccess.GetPxeHeader().sequenceNum != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.container == null)
                    {
                        m_CaseObj.scanInfo.container = new Container();
                    }

                    m_CaseObj.scanInfo.container.SequenceNum = _PxeAccess.GetPxeHeader().sequenceNum.ToString();
                }

                if (_PxeAccess.GetPxeHeader().batchNumber != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.conveyance == null)
                    {
                        m_CaseObj.scanInfo.conveyance = new Conveyance();
                    }

                    m_CaseObj.scanInfo.conveyance.BatchNum = _PxeAccess.GetPxeHeader().batchNumber.ToString();
                }

                if (_PxeAccess.GetPxeHeader().viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy  = null;
                    ViewType     viewType   = ViewType.Unknown;

                    int width  = (int)_PxeAccess.GetPxeHeader().viewBuffer_0.width;
                    int height = (int)_PxeAccess.GetPxeHeader().viewBuffer_0.height;

                    if (_PxeAccess.GetPxeHeader().viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        lowEnergy  = new SourceObject(_PxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType   = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType   = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType  = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View0",
                                                        _PxeAccess.GetPxeHeader().pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        _PxeAccess.GetPxeHeader().detectorsPerBoard,
                                                        _PxeAccess.GetPxeHeader().bitsPerPixel,
                                                        _PxeAccess.GetPxeHeader().samplingSpeed,
                                                        _PxeAccess.GetPxeHeader().samplingSpace,
                                                        GetAnnotationsForView("View0"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List <System.Windows.Rect>();
                        viewObj.TIPMarkings.Add(view0Rect);
                    }

                    ret.Add(viewObj);
                }

                if (_PxeAccess.GetPxeHeader().viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy  = null;
                    ViewType     viewType   = ViewType.Unknown;

                    int width  = (int)_PxeAccess.GetPxeHeader().viewBuffer_1.width;
                    int height = (int)_PxeAccess.GetPxeHeader().viewBuffer_1.height;

                    if (_PxeAccess.GetPxeHeader().viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        lowEnergy  = new SourceObject(_PxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType   = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType   = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && _PxeAccess.GetPxeHeader().viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(_PxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType  = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View1",
                                                        _PxeAccess.GetPxeHeader().pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        _PxeAccess.GetPxeHeader().detectorsPerBoard,
                                                        _PxeAccess.GetPxeHeader().bitsPerPixel,
                                                        _PxeAccess.GetPxeHeader().samplingSpeed,
                                                        _PxeAccess.GetPxeHeader().samplingSpace,
                                                        GetAnnotationsForView("View1"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List <System.Windows.Rect>();
                        viewObj.TIPMarkings.Add(view1Rect);
                    }

                    ret.Add(viewObj);
                }
            }

            return(ret);
        }