private void noiseReductionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // cursor relogio

            //copy Undo Image
            imgUndo = img.Copy();

            ImageClass.NoiseReduction(img, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9);

            ImageViewer.Refresh();    // atualiza imagem no ecrã

            Cursor = Cursors.Default; // cursor normal
        }
        private void effectsFiltersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // cursor relogio

            //copy Undo Image
            imgUndo = img.Copy();

            weightMatrix form = new weightMatrix();

            form.ShowDialog();

            if (!form.Cancel)
            {
                ImageClass.NoiseReduction(img, form.WeightMtx[0], form.WeightMtx[1], form.WeightMtx[2], form.WeightMtx[3], form.WeightMtx[4], form.WeightMtx[5], form.WeightMtx[6], form.WeightMtx[7], form.WeightMtx[8], form.Weight1);
            }

            ImageViewer.Refresh();    // atualiza imagem no ecrã

            Cursor = Cursors.Default; // cursor normal
        }