示例#1
0
        private void MultiAngle_Load(object sender, EventArgs e)
        {
            // Center parent:
            if (Owner != null)
            {
                Location = new Point(Owner.Location.X + Owner.Width / 2 - Width / 2,
                                     Owner.Location.Y + Owner.Height / 2 - Height / 2);
            }

            // Load settings:
            this.nudMultiAngle_From.Value = Properties.Settings.Default.MultiOffset_From;
            this.nudMultiAngle_To.Value   = Properties.Settings.Default.MultiOffset_To;
            this.zOutputPathTxb.Text      = Properties.Settings.Default.MultiAngle_Path;

            this.lblInputTDF.Text          = Path.GetFileName(mInputTDF);
            this.lblSliceNr.Text           = mImageIndex.ToString();
            this.lblAlgorithm.Text         = mReconFunc;
            this.lblDecimationFactor.Text  = mDecimateFactor.ToString();
            this.lblDownscalingFactor.Text = mDownscaleFactor.ToString();
            this.lblOffset.Text            = mCenter.ToString();
            this.lblAngles.Text            = (mAngles / Math.PI * 180.0).ToString("0.000");
            this.lblPreProcessing.Text     = mPreProcess ? "yes" : "no";
            this.lblPostProcessing.Text    = mPostProcess ? "yes" : "no";
            this.lblPhaseRetrieval.Text    = mPhaseRetrieval ? "yes" : "no";

            this.nudMultiAngle_From.Minimum = 0;
            this.nudMultiAngle_From.Maximum = TDFReader.GetNumberOfProjections(mInputTDF) - 1;
            this.nudMultiAngle_From.Value   = Convert.ToDecimal(this.mAnglesProjTo) - 100;


            this.nudMultiAngle_To.Minimum = 0;
            this.nudMultiAngle_To.Maximum = TDFReader.GetNumberOfProjections(mInputTDF) - 1;
            this.nudMultiAngle_To.Value   = Convert.ToDecimal(this.mAnglesProjTo);
        }
示例#2
0
文件: TDF2TIFF.cs 项目: gbzan/STP-Gui
        private void btnConvert_Click(object sender, EventArgs e)
        {
            string zTDFFile = ((KeyValuePair <string, string>) this.cbxInput.SelectedItem).Key;
            IJob   zJob;

            // Create an instance for the phase retrieval job:
            zJob = new TDF2TIFFJob(
                zTDFFile,
                this.zOutputPathTxb.Text,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudTDFToTIFFFrom.Value) : 0,
                (this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudTDFToTIFFTo.Value) : Convert.ToInt32(this.nudTDFToTIFFTo.Maximum),
                (this.chkData.Checked) ? tbxProjectionPrefix.Text : "-",
                (this.tbxFlatPrefix.Enabled) ? ((this.chkDataWhite.Checked) ? tbxFlatPrefix.Text : "-") : "-",
                (this.tbxDarkPrefix.Enabled) ? ((this.chkDataDark.Checked) ? tbxDarkPrefix.Text : "-") : "-",
                this.rbtDirectOrder.Checked,
                this.btnTIFFFormat.Checked,
                1
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            if (chkData.Checked)
            {
                mJobMonitor.Run(zExecuter, tbxProjectionPrefix.Text);
            }
            else
            {
                if ((chkDataDark.Checked) && !(chkDataWhite.Checked))
                {
                    // Only darks are created:
                    mJobMonitor.Run(zExecuter, this.tbxDarkPrefix.Text, TDFReader.GetNumberOfDarks(zTDFFile));
                }
                else
                {
                    if (!(chkDataDark.Checked) && (chkDataWhite.Checked))
                    {
                        // Only flats are created:
                        mJobMonitor.Run(zExecuter, this.tbxFlatPrefix.Text, TDFReader.GetNumberOfFlats(zTDFFile));
                    }
                    else
                    {
                        // Both flats and darks are created but STP-Core first creates
                        // flats and then darks, so monitor the dark prefix:
                        mJobMonitor.Run(zExecuter, this.tbxDarkPrefix.Text, TDFReader.GetNumberOfDarks(zTDFFile));
                    }
                }
            }
        }
示例#3
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            // Execute with conventional flat fielding:
            zJob = new PreProcessingJob(
                // Get combobox selection (in handler)
                this.mInputTDF,
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf",
                0,
                TDFReader.GetNumberOfSlices(mInputTDF) - 1,
                mAirSx,
                mAirDx,
                this.mFlatEnd,    // use flat at the end
                this.mHalfHalf,
                this.mHalfHalfLine,
                this.mExtFOV,
                this.mExtFOVRight,
                this.mExtFOVOverlap,
                this.mExtFOVNormalize,
                this.mExtFOVAverage,
                this.mRingRemoval,
                this.mDynamicFlatFielding,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses),
                false,
                "-"
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "sino");

            this.mPreProcessOnGoing = true;

            this.lblPreProcessing.Enabled  = true;
            this.lblPhaseRetrieval.Enabled = false;
            this.lblReconstruction.Enabled = false;

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
示例#4
0
文件: TDF2TIFF.cs 项目: gbzan/STP-Gui
        private void rbtSinogramOrder_CheckedChanged(object sender, EventArgs e)
        {
            this.SuspendLayout();

            if (rbtSinogramOrder.Checked)
            {
                this.tbxProjectionPrefix.Text = "sino";
                this.lblProjections.Text      = "Sinograms:";
                this.lblProjections.Location  = new Point(22, 26);

                if (File.Exists(zInputTDF))
                {
                    this.nudTDFToTIFFFrom.Maximum = TDFReader.GetNumberOfSlices(zInputTDF) - 1;
                    this.nudTDFToTIFFTo.Maximum   = TDFReader.GetNumberOfSlices(zInputTDF) - 1;
                }
            }

            this.ResumeLayout();
        }
示例#5
0
文件: TDF2TIFF.cs 项目: gbzan/STP-Gui
        private void cbxInput_DropDownClosed(object sender, EventArgs e)
        {
            this.SuspendLayout();

            zInputTDF = ((KeyValuePair <string, string>) this.cbxInput.SelectedItem).Key;


            // Check if selected TDF exists:
            if (File.Exists(zInputTDF))
            {
                if (rbtDirectOrder.Checked)
                {
                    this.nudTDFToTIFFFrom.Maximum = TDFReader.GetNumberOfProjections(zInputTDF) - 1;
                    this.nudTDFToTIFFTo.Maximum   = TDFReader.GetNumberOfProjections(zInputTDF) - 1;
                }
                else
                {
                    this.nudTDFToTIFFFrom.Maximum = TDFReader.GetNumberOfSlices(zInputTDF) - 1;
                    this.nudTDFToTIFFTo.Maximum   = TDFReader.GetNumberOfSlices(zInputTDF) - 1;
                }

                this.chkDataDark.Enabled = (TDFReader.HasDarks(zInputTDF));
                if (!(this.chkDataDark.Enabled))
                {
                    this.tbxDarkPrefix.Enabled = false;
                }
                else
                {
                    this.chkDataDark_CheckedChanged(null, null);
                }
                this.chkDataWhite.Enabled = (TDFReader.HasDarks(zInputTDF));
                if (!(this.chkDataWhite.Enabled))
                {
                    this.tbxFlatPrefix.Enabled = false;
                }
                else
                {
                    this.chkDataWhite_CheckedChanged(null, null);
                }
            }

            this.ResumeLayout();
        }
示例#6
0
        private void runPhaseRetrieval(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            // Execute with conventional flat fielding:
            mPreProcessOnGoing     = false;
            mReconstructionOnGoing = false;

            // Execute with conventional flat fielding:
            zJob = new PhaseRetrievalJob(
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf",
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf",
                this.mMethod,
                0,
                TDFReader.GetNumberOfProjections(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr.tdf") - 1,
                this.mParam1,
                this.mParam2,
                this.mDistance,
                this.mEnergy,
                this.mPixelsize,
                this.mPad,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses)
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            mJobMonitor.Run(zExecuter, "tomo");

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;

            mPhaseRetrievalOnGoing = true;
        }
示例#7
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            // Run GDEI Job:
            IJob zJob;

            string zInputFile_1 = ((KeyValuePair <string, string>) this.cbxGDEI_Input2.SelectedItem).Key;
            string zInputFile_2 = ((KeyValuePair <string, string>) this.cbxGDEI_Input1.SelectedItem).Key;
            string zInputFile_3 = ((KeyValuePair <string, string>) this.cbxGDEI_Input3.SelectedItem).Key;

            String[] zSubStrings   = Path.GetFileName(zInputFile_1).Split('_');
            string   zOutputPrefix = string.Empty;

            for (int i = 0; i < zSubStrings.Length - 1; i++)
            {
                zOutputPrefix += zSubStrings[i];
            }

            string zOutputFile_Abs  = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_abs" + Properties.Settings.Default.TomoDataFormatExtension;
            string zOutputFile_Refr = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_ref" + Properties.Settings.Default.TomoDataFormatExtension;
            string zOutputFile_Sca  = Properties.Settings.Default.FormSettings_WorkingPath + Path.DirectorySeparatorChar + zOutputPrefix + "_sca" + Properties.Settings.Default.TomoDataFormatExtension;

            // Create an instance for the phase retrieval job:
            zJob = new GDEIJob(
                zInputFile_1,
                zInputFile_2,
                zInputFile_3,
                zOutputFile_Abs,
                zOutputFile_Refr,
                zOutputFile_Sca,
                0,                                             //(this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFFrom.Value) : 0,
                TDFReader.GetNumberOfSlices(zInputFile_1) - 1, //-1, //(this.chkConsiderSubset.Checked) ? Convert.ToInt32(this.nudConvertToTDFTo.Value) : -1,
                this.mAirSx,
                this.mAirDx,
                this.mFlatEnd,
                this.mHalfHalf,
                this.mHalfHalfLine,
                this.mExtFOV,
                this.mExtFOVRight,
                this.mExtFOVOverlap,
                this.mExtFOVNormalize,
                this.mExtFOVAverage,
                this.mRingRemoval,
                this.mDynamicFlatFielding,
                Convert.ToInt32(this.nudGDEI_ShiftVert1.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz1.Value),
                Convert.ToInt32(this.nudGDEI_ShiftVert2.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz2.Value),
                Convert.ToInt32(this.nudGDEI_ShiftVert3.Value),
                Convert.ToInt32(this.nudGDEI_ShiftHoriz3.Value),

                Convert.ToDouble(this.nudGDEI_r1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_r2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_r3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_r3Exp.Value)),

                Convert.ToDouble(this.nudGDEI_d1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_d2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_d3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_d3Exp.Value)),

                Convert.ToDouble(this.nudGDEI_dd1.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd1Exp.Value)),
                Convert.ToDouble(this.nudGDEI_dd2.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd2Exp.Value)),
                Convert.ToDouble(this.nudGDEI_dd3.Value) * Math.Pow(10, Convert.ToDouble(this.nudGDEI_dd3Exp.Value)),

                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses)
                );

            // Create an instance of JobExecuter with the Phase Retrieval job
            // splitting it into several processes (if specified):
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job:
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "sino");

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }
示例#8
0
        private void runReconstruction(object sender, EventArgs e)
        {
            // Run Job Convert To TDF:
            IJob zJob;

            mPreProcessOnGoing     = false;
            mPhaseRetrievalOnGoing = false;

            string zOutputPath = Properties.Settings.Default.FormSettings_OutputPath + Path.DirectorySeparatorChar +
                                 Path.GetFileNameWithoutExtension(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") +
                                 Path.DirectorySeparatorChar + @"slices" + Path.DirectorySeparatorChar;

            if (mAngles_ProjTo == 0)
            {
                mAngles_ProjTo = TDFReader.GetNumberOfProjections(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") - 1;
            }

            // Create an instance for the reconstruction job:
            zJob = new ReconstructionJob(
                // Get combobox selection (in handler)
                this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf",
                zOutputPath,
                false,
                mAirSx,
                mAirDx,
                mFlatEnd,
                mHalfHalf,
                mHalfHalfLine,
                mExtFOV,
                mExtFOVRight,
                mExtFOVOverlap,
                mExtFOVNormalize,
                mExtFOVAverage,
                mRingRemoval,

                mAngles,
                mAngles_ProjFrom,
                mAngles_ProjTo,
                mCenter,
                mReconFunc,
                mReconParam1,
                mScale,
                mOverPaddding,
                mLogTransform,
                mCircle,
                mZeroneMode,
                mCorrectionOffset,
                0,
                TDFReader.GetNumberOfSlices(this.mInputTDF.Remove(this.mInputTDF.Length - 4) + "_corr_phrt.tdf") - 1,
                Convert.ToInt32(Properties.Settings.Default.FormSettings_NrOfProcesses),
                mDecimateFactor,
                mDownscaleFactor,

                mPostProcess,
                mPostProcessPolarFilt,
                mPostProcessConvertArgs,
                mPostProcessCropArgs,
                mDynamicFlatFielding,

                mRolling,
                mRollShift
                );


            // Create an instance of JobExecuter with the pre processing job:
            JobExecuter zExecuter = new JobExecuter(zJob);

            // Execute the job splitting it with several processes (if specified):
            zExecuter.Run();

            // Start the monitoring of the job:
            mJobMonitor.Run(zExecuter, "slice");

            this.mReconstructionOnGoing = true;

            // Reset status bar:
            this.toolStripStatusLabel1.Text = string.Empty;
        }