예제 #1
0
파일: Technique.cs 프로젝트: LeBoozer/msec
 // Constructor
 public Technique(TechniqueID _techniqueID, delegate_hash _hashFunc, delegate_comp _compFunc) :
     base(_techniqueID)
 {
     // Copy parameter
     m_funcHash = _hashFunc;
     m_funcComp = _compFunc;
 }
예제 #2
0
 // Returns the image source for a certain technique (can be null!)
 public ImageSource getComparisonDataFor(TechniqueID _id)
 {
     if (m_imageSources.ContainsKey(_id) == false)
     {
         return(null);
     }
     return(m_imageSources[_id]);
 }
예제 #3
0
 // Returns the comparison data for a certain technique (can be null!)
 public ComparativeData getComparisonDataFor(TechniqueID _id)
 {
     if (m_comparisonData.ContainsKey(_id) == false)
     {
         return(null);
     }
     return(m_comparisonData[_id]);
 }
예제 #4
0
    // Enables/disables the controls of the specified technique
    private void setTechniqueControlsEnabled(TechniqueID _id, bool _enabled, bool _clearCheckState = false)
    {
        // RADISH?
        if (_id == TechniqueID.RADISH)
        {
            if (_clearCheckState == true)
            {
                m_checkTechniqueRadish.Checked = false;
            }
            m_labelRadishGamma.Enabled   = _enabled;
            m_labelRadishSigma.Enabled   = _enabled;
            m_labelRadishAngles.Enabled  = _enabled;
            m_numberRadishSigma.Enabled  = _enabled;
            m_numberRadishGamma.Enabled  = _enabled;
            m_numberRadishAngles.Enabled = _enabled;
        }

        // Wavelet?
        else if (_id == TechniqueID.WAVELET)
        {
            if (_clearCheckState == true)
            {
                m_checkTechniqueWavelet.Checked = false;
            }
            m_labelWaveletAlpha.Enabled  = _enabled;
            m_labelWaveletLevel.Enabled  = _enabled;
            m_numberWaveletAlpha.Enabled = _enabled;
            m_numberWaveletLevel.Enabled = _enabled;
        }

        // BMB
        else if (_id == TechniqueID.BMB)
        {
            if (_clearCheckState == true)
            {
                m_checkTechniqueBMB.Checked = false;
            }
            m_labelBMBMethod.Enabled = _enabled;
            m_comboBMBMethod.Enabled = _enabled;
        }

        // DCT
        else if (_id == TechniqueID.DCT)
        {
            if (_clearCheckState == true)
            {
                m_checkTechniqueDCT.Checked = false;
            }
        }
    }
예제 #5
0
        // Retrieves the timings for a certain image and technique
        private bool getTimingsFor(ImageSourceBinding _binding, TechniqueID _id, out double _loadingTime, out double _computationTime)
        {
            // Local variables
            HashDataTimings timings = null;

            // Check parameter
            if (_binding == null || _binding.getComparisonDataFor(_id) == null || _binding.getComparisonDataFor(_id).HashData.getTimings() == null)
            {
                _loadingTime = _computationTime = 0.0;
                return(false);
            }
            timings = _binding.getComparisonDataFor(_id).HashData.getTimings();

            // Set data
            _loadingTime     = timings.ImageLoadingTimeMS;
            _computationTime = timings.HashComputationTimeMS;

            return(true);
        }
예제 #6
0
파일: Technique.cs 프로젝트: LeBoozer/msec
 // Constructor
 public Technique(TechniqueID _techniqueID)
 {
     // Copy parameter
     m_techniqueID = _techniqueID;
 }
예제 #7
0
 // Adds the image source for a certain technique
 public void setComparisonDataFor(TechniqueID _id, ImageSource _data)
 {
     m_imageSources.Add(_id, _data);
 }
예제 #8
0
    // Handles technique selection events
    // Returns false if invalid operation
    private bool _onTechniqueSelectionChanged(TechniqueID _selectedTechnique, bool _checked)
    {
        // Local variables
        TechniqueID tempIDs = 0;

        // Choose operator mode
        if (m_operationMode == eMode.SINGLE)
        {
            // Technique cannot be unselected
            if (m_helperSingleMode == _selectedTechnique && _checked == false)
            {
                return(false);
            }

            // Disable current technique's controls
            setTechniqueControlsEnabled(m_helperSingleMode, false, true);

            // Set
            m_currentTechniqueIDs &= ~m_helperSingleMode;
            m_helperSingleMode     = _selectedTechnique;
            m_currentTechniqueIDs |= _selectedTechnique;

            // Enable current technique's controls
            setTechniqueControlsEnabled(m_helperSingleMode, true);

            // Notify listener
            OnTechniqueIDsChanged(m_currentTechniqueIDs);
        }
        else
        {
            // Check?
            if (_checked == true)
            {
                // Add technique
                m_currentTechniqueIDs |= _selectedTechnique;

                // Enable technique's controls
                setTechniqueControlsEnabled(_selectedTechnique, true);
            }
            else
            {
                // Save current IDs
                tempIDs = m_currentTechniqueIDs;

                // Remove technique from IDs
                tempIDs &= ~_selectedTechnique;
                if (tempIDs == 0)
                {
                    return(false);       // At least one technique must be set!
                }
                // Apply changes
                m_currentTechniqueIDs = tempIDs;
                setTechniqueControlsEnabled(_selectedTechnique, false);
            }

            // Notify listener
            OnTechniqueIDsChanged(m_currentTechniqueIDs);
        }

        return(true);
    }
예제 #9
0
    // Initializes the user control
    private void initializeUserControl()
    {
        #region General
        // Get controls
        m_numberGeneralThreshold = this.Number_General_Threshold;

        // Extract default values
        m_generalThreshold = m_numberGeneralThreshold.Value;
        #endregion General

        #region Technique::Radish
        // Get controls
        m_checkTechniqueRadish = this.Check_Technique_Radish;
        m_labelRadishGamma     = this.Label_Technique_Radish_Gamma;
        m_labelRadishSigma     = this.Label_Technique_Radish_Sigma;
        m_labelRadishAngles    = this.Label_Technique_Radish_Angles;
        m_numberRadishGamma    = this.Number_Technique_Radish_Gamma;
        m_numberRadishSigma    = this.Number_Technique_Radish_Sigma;
        m_numberRadishAngles   = this.Number_Technique_Radish_Angles;

        // Extract default values
        m_radishGamma  = m_numberRadishGamma.Value;
        m_radishSigma  = m_numberRadishSigma.Value;
        m_radishAngles = m_numberRadishAngles.Value;
        #endregion Technique::Radish

        #region Technique::DCT
        // Get controls
        m_checkTechniqueDCT = this.Check_Technique_DCT;
        #endregion Technique::DCT

        #region Technique::Wavelet
        // Get controls
        m_checkTechniqueWavelet = this.Check_Technique_Wavelet;
        m_labelWaveletAlpha     = this.Label_Technique_Wavelet_Alpha;
        m_labelWaveletLevel     = this.Label_Technique_Wavelet_Level;
        m_numberWaveletAlpha    = this.Number_Technique_Wavelet_Alpha;
        m_numberWaveletLevel    = this.Number_Technique_Wavelet_Level;

        // Extract default values
        m_waveletAlpha = m_numberWaveletAlpha.Value;
        m_waveletLevel = m_numberWaveletLevel.Value;
        #endregion Technique::Wavelet

        #region Technique::BMB
        // Get controls
        m_checkTechniqueBMB = this.Check_Technique_BMB;
        m_labelBMBMethod    = this.Label_Technique_BMB_Method;
        m_comboBMBMethod    = this.Combo_Technique_BMB_Method;

        // Extract default values
        m_comboBMBMethod.SelectedIndex = 0;
        m_bmbMethod = int.Parse(m_comboBMBMethod.Text);
        #endregion Technique::BMB

        #region Set start technique IDs
        // Set start technique ID
        if (m_checkTechniqueDCT.Checked == true)
        {
            m_helperSingleMode     = TechniqueID.DCT;
            m_currentTechniqueIDs |= TechniqueID.DCT;
        }
        if (m_checkTechniqueWavelet.Checked == true)
        {
            m_helperSingleMode     = TechniqueID.WAVELET;
            m_currentTechniqueIDs |= TechniqueID.WAVELET;
        }
        if (m_checkTechniqueRadish.Checked == true)
        {
            m_helperSingleMode     = TechniqueID.RADISH;
            m_currentTechniqueIDs |= TechniqueID.RADISH;
        }
        if (m_checkTechniqueBMB.Checked == true)
        {
            m_helperSingleMode     = TechniqueID.BMB;
            m_currentTechniqueIDs |= TechniqueID.BMB;
        }

        // Disable controls from not set technique IDs
        if ((m_currentTechniqueIDs & TechniqueID.DCT) != TechniqueID.DCT)
        {
            setTechniqueControlsEnabled(TechniqueID.DCT, false);
        }
        if ((m_currentTechniqueIDs & TechniqueID.WAVELET) != TechniqueID.WAVELET)
        {
            setTechniqueControlsEnabled(TechniqueID.WAVELET, false);
        }
        if ((m_currentTechniqueIDs & TechniqueID.RADISH) != TechniqueID.RADISH)
        {
            setTechniqueControlsEnabled(TechniqueID.RADISH, false);
        }
        if ((m_currentTechniqueIDs & TechniqueID.BMB) != TechniqueID.BMB)
        {
            setTechniqueControlsEnabled(TechniqueID.BMB, false);
        }
        #endregion Set start technique IDs
    }
예제 #10
0
 // Adds the comparison data for a certain technique
 public void setComparisonDataFor(TechniqueID _id, ComparativeData _data)
 {
     m_comparisonData.Add(_id, _data);
 }
예제 #11
0
        // Sets the timings for a certain technique
        private void setTimingsFor(TechniqueID _id, ImageSourceBinding _b0, ImageSourceBinding _b1)
        {
            // Local variables
            Label  loadingLabel       = null;
            Label  computationLabel   = null;
            Label  totalLabel         = null;
            bool   validData          = false;
            string loadingString0     = "-";
            string computationString0 = "-";
            string totalString0       = "-";
            string loadingString1     = "-";
            string computationString1 = "-";
            string totalString1       = "-";

            // Get label references
            if (_id == TechniqueID.RADISH)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_RADISH;
                computationLabel = CC_Label_Computation_RADISH;
                totalLabel       = CC_Label_Total_RADISH;
            }
            else if (_id == TechniqueID.DCT)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_DCT;
                computationLabel = CC_Label_Computation_DCT;
                totalLabel       = CC_Label_Total_DCT;
            }
            else if (_id == TechniqueID.WAVELET)
            {
                // Set references
                loadingLabel     = CC_Label_Loading_Wavelet;
                computationLabel = CC_Label_Computation_Wavelet;
                totalLabel       = CC_Label_Total_Wavelet;
            }
            else
            {
                // Set references
                loadingLabel     = CC_Label_Loading_BMB;
                computationLabel = CC_Label_Computation_BMB;
                totalLabel       = CC_Label_Total_BMB;
            }

            // Get timings for the first image
            if (_b0.getComparisonDataFor(_id) != null && _b0.getComparisonDataFor(_id).HashData.getTimings() != null)
            {
                loadingString0     = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedLoadingTime();
                computationString0 = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedComputationTime();
                totalString0       = _b0.getComparisonDataFor(_id).HashData.getTimings().getFormattedTotalTime();
                validData          = true;
            }

            // Get timings for the second image
            if (_b1.getComparisonDataFor(_id) != null && _b1.getComparisonDataFor(_id).HashData.getTimings() != null)
            {
                loadingString1     = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedLoadingTime();
                computationString1 = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedComputationTime();
                totalString1       = _b1.getComparisonDataFor(_id).HashData.getTimings().getFormattedTotalTime();
                validData          = true;
            }

            // Set timings
            if (loadingLabel != null)
            {
                if (validData == true)
                {
                    loadingLabel.Text     = string.Format(TEXT_TEMPLATE_TIMING, loadingString0, loadingString1);
                    computationLabel.Text = string.Format(TEXT_TEMPLATE_TIMING, computationString0, computationString1);
                    totalLabel.Text       = string.Format(TEXT_TEMPLATE_TIMING, totalString0, totalString1);
                }
                else
                {
                    loadingLabel.Text     = "-";
                    computationLabel.Text = "-";
                    totalLabel.Text       = "-";
                }
            }
        }