Ejemplo n.º 1
0
        // Dumps a compairison pair for the technique "DCT" to disk
        public static bool dumpDCTStepsToDiskFor(UnfoldedBindingComparisonPair _pair)
        {
            // Local variables
            Technique t = Technique.createTechniqueDCT();

            string[] pathesSource0 = new string[DCT_PATH_COUNT];
            string[] pathesSource1 = new string[DCT_PATH_COUNT];

            // Create pathes
            pathesSource0[0] = TARGET_FOLDER + string.Format(DCT_PATH_MEANFILTER, 0);
            pathesSource0[1] = TARGET_FOLDER + string.Format(DCT_PATH_RESIZED, 0);
            pathesSource0[2] = TARGET_FOLDER + string.Format(DCT_PATH_DCTMATRIX, 0);
            pathesSource0[3] = TARGET_FOLDER + string.Format(DCT_PATH_DCTIMAGE, 0);
            pathesSource0[4] = TARGET_FOLDER + string.Format(DCT_PATH_DCTIMAGE_SUBSEC, 0);
            pathesSource0[5] = TARGET_FOLDER + string.Format(DCT_PATH_MEDIAN, 0);

            pathesSource1[0] = TARGET_FOLDER + string.Format(DCT_PATH_MEANFILTER, 1);
            pathesSource1[1] = TARGET_FOLDER + string.Format(DCT_PATH_RESIZED, 1);
            pathesSource1[2] = TARGET_FOLDER + string.Format(DCT_PATH_DCTMATRIX, 1);
            pathesSource1[3] = TARGET_FOLDER + string.Format(DCT_PATH_DCTIMAGE, 1);
            pathesSource1[4] = TARGET_FOLDER + string.Format(DCT_PATH_DCTIMAGE_SUBSEC, 1);
            pathesSource1[5] = TARGET_FOLDER + string.Format(DCT_PATH_MEDIAN, 1);

            // First source
            var j0 = new Job <bool?>((JobParameter <bool?> _params) =>
            {
                // Dump to disk
                return(t.dumpIntermediateResultsToDisk(_pair.Source0, pathesSource0));
            },
                                     (JobParameter <bool?> _params) =>
            {
                if (_params.Error != null)
                {
                    MessageBox.Show(_params.Error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
                                     );

            // Second source
            var j1 = new Job <bool?>((JobParameter <bool?> _params) =>
            {
                // Dump to disk
                return(t.dumpIntermediateResultsToDisk(_pair.Source1, pathesSource1));
            },
                                     (JobParameter <bool?> _params) =>
            {
                if (_params.Error != null)
                {
                    MessageBox.Show(_params.Error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
                                     );

            // Wait for jobs
            j0.waitForDone();
            j1.waitForDone();

            return(j0.Result.Value && j1.Result.Value);
        }
Ejemplo n.º 2
0
        // Constructor
        protected ViewWithTechniqueSelection(TabPage _tabPage, string _nameControlTechniqueSelection) :
            base(_tabPage)
        {
            // Extract technique selection
            m_controlTechniqueSelection = _tabPage.Controls.Find(_nameControlTechniqueSelection, true)[0] as TechniqueSelection;

            // Create techniques
            m_techniqueRadish  = Technique.createTechniqueRadish();
            m_techniqueDCT     = Technique.createTechniqueDCT();
            m_techniqueWavelet = Technique.createTechniqueWavelet();
            m_techniqueBMB     = Technique.createTechniqueBMB();

            // Set default values for: general
            m_techniqueDCT.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
            m_techniqueRadish.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
            m_techniqueWavelet.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
            m_techniqueBMB.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);

            // Set default values for: RADISH
            m_techniqueRadish.addAttribute(Technique.ATT_RADISH_GAMMA, m_controlTechniqueSelection.RadishGamma);
            m_techniqueRadish.addAttribute(Technique.ATT_RADISH_SIGMA, m_controlTechniqueSelection.RadishSigma);
            m_techniqueRadish.addAttribute(Technique.ATT_RADISH_NUM_ANGLES, m_controlTechniqueSelection.RadishNumberOfAngles);

            // Set default values for: wavelet
            m_techniqueWavelet.addAttribute(Technique.ATT_WAVELET_ALPHA, m_controlTechniqueSelection.WaveletAlpha);
            m_techniqueWavelet.addAttribute(Technique.ATT_WAVELET_LEVEL, m_controlTechniqueSelection.WaveletLevel);

            // Set default values for: BMB
            m_techniqueBMB.addAttribute(Technique.ATT_BMB_METHOD, m_controlTechniqueSelection.BMBMethod);

            // Set current technique
            if (m_controlTechniqueSelection.OperationMode == TechniqueSelection.eMode.SINGLE)
            {
                if (m_controlTechniqueSelection.CurrentTechniqueIDs == TechniqueID.RADISH)
                {
                    m_singleTechnique = m_techniqueRadish;
                }
                else if (m_controlTechniqueSelection.CurrentTechniqueIDs == TechniqueID.WAVELET)
                {
                    m_singleTechnique = m_techniqueWavelet;
                }
                else if (m_controlTechniqueSelection.CurrentTechniqueIDs == TechniqueID.DCT)
                {
                    m_singleTechnique = m_techniqueDCT;
                }
                else
                {
                    m_singleTechnique = m_techniqueBMB;
                }
            }
            else
            {
                m_multipleTechniques.Clear();
                if ((m_controlTechniqueSelection.CurrentTechniqueIDs & TechniqueID.DCT) == TechniqueID.DCT)
                {
                    m_multipleTechniques.Add(m_techniqueDCT);
                }
                if ((m_controlTechniqueSelection.CurrentTechniqueIDs & TechniqueID.RADISH) == TechniqueID.RADISH)
                {
                    m_multipleTechniques.Add(m_techniqueRadish);
                }
                if ((m_controlTechniqueSelection.CurrentTechniqueIDs & TechniqueID.WAVELET) == TechniqueID.WAVELET)
                {
                    m_multipleTechniques.Add(m_techniqueWavelet);
                }
                if ((m_controlTechniqueSelection.CurrentTechniqueIDs & TechniqueID.BMB) == TechniqueID.BMB)
                {
                    m_multipleTechniques.Add(m_techniqueBMB);
                }
            }

            // Set attribute events
            m_controlTechniqueSelection.OnTechniqueIDsChanged += (TechniqueID _id) =>
            {
                if (m_controlTechniqueSelection.OperationMode == TechniqueSelection.eMode.SINGLE)
                {
                    if (_id == TechniqueID.RADISH)
                    {
                        m_singleTechnique = m_techniqueRadish;
                    }
                    else if (_id == TechniqueID.WAVELET)
                    {
                        m_singleTechnique = m_techniqueWavelet;
                    }
                    else if (_id == TechniqueID.DCT)
                    {
                        m_singleTechnique = m_techniqueDCT;
                    }
                    else
                    {
                        m_singleTechnique = m_techniqueBMB;
                    }
                }
                else
                {
                    m_multipleTechniques.Clear();
                    if ((_id & TechniqueID.DCT) == TechniqueID.DCT)
                    {
                        m_multipleTechniques.Add(m_techniqueDCT);
                    }
                    if ((_id & TechniqueID.RADISH) == TechniqueID.RADISH)
                    {
                        m_multipleTechniques.Add(m_techniqueRadish);
                    }
                    if ((_id & TechniqueID.WAVELET) == TechniqueID.WAVELET)
                    {
                        m_multipleTechniques.Add(m_techniqueWavelet);
                    }
                    if ((_id & TechniqueID.BMB) == TechniqueID.BMB)
                    {
                        m_multipleTechniques.Add(m_techniqueBMB);
                    }
                }
            };

            m_controlTechniqueSelection.OnGeneralThresholdChanged += (decimal _v) =>
            {
                m_techniqueDCT.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
                m_techniqueRadish.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
                m_techniqueWavelet.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
                m_techniqueBMB.addAttribute(Technique.ATT_GENERAL_THRESHOLD, m_controlTechniqueSelection.Threshold);
            };

            m_controlTechniqueSelection.OnRadishGammaChanged += (decimal _v) =>
            { m_techniqueRadish.addAttribute(Technique.ATT_RADISH_GAMMA, m_controlTechniqueSelection.RadishGamma); };
            m_controlTechniqueSelection.OnRadishSigmaChanged += (decimal _v) =>
            { m_techniqueRadish.addAttribute(Technique.ATT_RADISH_SIGMA, m_controlTechniqueSelection.RadishSigma); };
            m_controlTechniqueSelection.OnRadishNumberOfAnglesChanged += (decimal _v) =>
            { m_techniqueRadish.addAttribute(Technique.ATT_RADISH_NUM_ANGLES, m_controlTechniqueSelection.RadishNumberOfAngles); };

            m_controlTechniqueSelection.OnWaveletAlphaChanged += (decimal _v) =>
            { m_techniqueWavelet.addAttribute(Technique.ATT_WAVELET_ALPHA, m_controlTechniqueSelection.WaveletAlpha); };
            m_controlTechniqueSelection.OnWaveletLevelChanged += (decimal _v) =>
            { m_techniqueWavelet.addAttribute(Technique.ATT_WAVELET_LEVEL, m_controlTechniqueSelection.WaveletLevel); };

            m_controlTechniqueSelection.OnBMBMethodChanged += (int _v) =>
            { m_techniqueBMB.addAttribute(Technique.ATT_BMB_METHOD, m_controlTechniqueSelection.BMBMethod); };
        }