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

            MemoryStream tipMS = null;

            bool injectTIP = false;

            PxeAccess.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;

                PxeAccess pxeAccess = new PxeAccess();

                Rect view0Rect = new Rect();
                Rect view1Rect = new Rect();

                if (injectTIP)
                {
                    tipStatus = new PxeAccess.TIPStatus();
                    pxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;                       
                    }
                    else
                    {
                        view0Rect = new 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 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.pxeHeader.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.pxeHeader.sequenceNum.ToString();
                }

                if (pxeAccess.pxeHeader.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.pxeHeader.batchNumber.ToString();
                }

                if (pxeAccess.pxeHeader.viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_0.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_0.height;

                    if (pxeAccess.pxeHeader.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);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL"), pxeAccess.GetImageBuffer("FinalAlpha"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.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.pxeHeader.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.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View0"));

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

                    m_View0HighEnergySource = highEnergy;

                    ret.Add(viewObj);                    
                }

                if (pxeAccess.pxeHeader.viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_1.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_1.height;

                    if (pxeAccess.pxeHeader.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);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL1"), pxeAccess.GetImageBuffer("FinalAlpha1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.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.pxeHeader.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.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View1"));

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

                    ret.Add(viewObj);                    
                }

                Conversion.SamplingSpace = pxeAccess.pxeHeader.samplingSpace;
            }

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

            MemoryStream tipMS = null;

            bool injectTIP = false;

            PxeAccess.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;

                PxeAccess pxeAccess = new PxeAccess();

                Rect view0Rect = new Rect();
                Rect view1Rect = new Rect();

                if (injectTIP)
                {
                    tipStatus = new PxeAccess.TIPStatus();
                    pxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;
                    }
                    else
                    {
                        view0Rect = new 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 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.pxeHeader.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.pxeHeader.sequenceNum.ToString();
                }

                if (pxeAccess.pxeHeader.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.pxeHeader.batchNumber.ToString();
                }

                if (pxeAccess.pxeHeader.viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy  = null;
                    SourceObject trimat     = null;
                    ViewType     viewType   = ViewType.Unknown;

                    int width  = (int)pxeAccess.pxeHeader.viewBuffer_0.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_0.height;

                    if (pxeAccess.pxeHeader.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);
                        trimat     = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL"), pxeAccess.GetImageBuffer("FinalAlpha"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType   = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.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.pxeHeader.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.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View0"));

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

                    m_View0HighEnergySource = highEnergy;

                    ret.Add(viewObj);
                }

                if (pxeAccess.pxeHeader.viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy  = null;
                    SourceObject trimat     = null;
                    ViewType     viewType   = ViewType.Unknown;

                    int width  = (int)pxeAccess.pxeHeader.viewBuffer_1.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_1.height;

                    if (pxeAccess.pxeHeader.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);
                        trimat     = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL1"), pxeAccess.GetImageBuffer("FinalAlpha1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType   = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.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.pxeHeader.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.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View1"));

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

                    ret.Add(viewObj);
                }

                Conversion.SamplingSpace = pxeAccess.pxeHeader.samplingSpace;
            }

            return(ret);
        }