Ejemplo n.º 1
0
        /// <summary>
        /// Submit latest result to sample tree.
        /// </summary>
        public void SubmitResultToTree()
        {
            // No Result
            if (Result == null)
            {
                return;
            }

            ClrMsDataVariant     msObj = new ClrMsDataVariant(_clrVariant);
            DataGroupNodeWrapper dgnw  = msObj.getSample().getRootDataGroupNode();

            //Add result to sample tree.
            SampleSetResampling sampleSet = new SampleSetResampling();
            SampleResampling    sample    = new SampleResampling(sampleSet);

            sample.openSample();
            DataGroupNodeWrapper root = sample.getRootDataGroupNode();

            sample.setName("Contaminant peak removed " + msObj.getSample().getName());
            root.setName("Contaminant peak removed " + dgnw.getName());

            int cnt = 0;

            for (int i = 0; i < Result.Spectrums.Count(); i++)
            {
                ClrDataPoints      pts = Result.DataPoints[i];
                SpectrumWrapper    sw  = Result.Spectrums[i];
                XYDataWrapper      xyd;
                SpectrumResampling spec;

                if (Result.Spectrums.Count == 1)
                {
                    spec = new SpectrumResampling(sample, sw.getName());
                }
                else
                {
                    cnt++;
                    spec = new SpectrumResampling(sample, Result.Spectrums[i].getName() + " (" + cnt.ToString() + ")");
                }
                xyd = spec.getXYData();
                spec.SetData(pts);
                spec.onGetXYData(xyd, -1.0, -1.0);
                spec.setMinX(pts.getMinX());
                spec.setMaxX(pts.getMaxX());
                spec.setMaxIntensity(pts.getMaxY());
                spec.setMsStage((int)sw.getMsStage());
                sample.setSampleIndex((int)0);
                root.addSpectrum(spec);
            }
            sampleSet.addSample(sample);
            ClrPluginCallTool.onOpenSample(sample);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Display Calculation Results on tree view
        /// </summary>
        public void DisplayCalculationResult()
        {
            // No Result
            if (_resultSpecCal == null)
            {
                return;
            }

            //Add result to sample tree.
            SampleSetResampling sampleSet = new SampleSetResampling();
            SampleResampling    sample    = new SampleResampling(sampleSet);

            sample.openSample();
            DataGroupNodeWrapper root = sample.getRootDataGroupNode();

            sample.setName(_resultSpecCal.Spectrums[0].getName() + " Sample");
            root.setName(_resultSpecCal.Spectrums[0].getName() + " Sample");

            int cnt = 0;

            foreach (SpectrumResampling sr in _resultSpecCal.Spectrums)
            {
                ClrDataPoints      xyd = new ClrDataPoints();
                SpectrumResampling spec;

                if (_resultSpecCal.Spectrums.Count == 1)
                {
                    spec = new SpectrumResampling(sample, sr.getName() + " Spectrum");
                }
                else
                {
                    cnt++;
                    spec = new SpectrumResampling(sample, sr.getName() + " Spectrum_" + cnt.ToString());
                }
                ClrDataPoints pts = new ClrDataPoints();
                sr.getXYData(pts, false);
                spec.getXYData(xyd, false);
                spec.SetData(pts);
                spec.setMinX(pts.getMinX());
                spec.setMaxX(pts.getMaxX());
                spec.setMaxIntensity(pts.getMaxY());
                spec.onGetXYData(xyd, -1.0, -1.0);
                spec.setMsStage((int)sr.getMsStage());
                sample.setSampleIndex((int)0);
                root.addSpectrum(spec);
            }
            sampleSet.addSample(sample);
            ClrPluginCallTool.onOpenSample(sample);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set Spectrum calculation result to active object.
        /// </summary>
        /// <param name="resultSpecCal">Spectrum calculation result</param>
        private static void SetResultToActiveObject(SpectrumCalculationResult resultSpecCal)
        {
            // Preparing Output files.
            SampleSetResampling sampleSet = new SampleSetResampling();
            SampleResampling    sample    = new SampleResampling(sampleSet);

            sample.openSample();
            DataGroupNodeWrapper root = sample.getRootDataGroupNode();

            // _resultSpecCal.Spectrums[0].getName() returns
            // "Average" or "Summed" or "Subtracted" or "Divided".
            sample.setName(resultSpecCal.Spectrums[0].getName() + " " + SAMPLE_STRING);
            root.setName(resultSpecCal.Spectrums[0].getName() + " " + SAMPLE_STRING);

            int cnt = 0;

            foreach (SpectrumResampling sr in resultSpecCal.Spectrums)
            {
                ClrDataPoints      xyd = new ClrDataPoints();
                SpectrumResampling spec;

                if (resultSpecCal.Spectrums.Count == 1)
                {
                    spec = new SpectrumResampling(sample, sr.getName() + " " + SPECTRUM_STRING);
                }
                else
                {
                    cnt++;
                    spec = new SpectrumResampling(sample, sr.getName() + " " + SPECTRUM_STRING + "_" + cnt.ToString());
                }
                ClrDataPoints pts = new ClrDataPoints();
                sr.getXYData(pts, false);
                spec.getXYData(xyd, false);
                spec.SetData(pts);
                spec.setMinX(pts.getMinX());
                spec.setMaxX(pts.getMaxX());
                spec.setMaxIntensity(pts.getMaxY());
                spec.onGetXYData(xyd, -1.0, -1.0);
                spec.setMsStage((int)sr.getMsStage());
                sample.setSampleIndex((int)0);
                root.addSpectrum(spec);
            }
            sampleSet.addSample(sample);

            // -out
            kome.clr.ActiveObjectsManagerWrapper aoMgr = kome.clr.ActiveObjectsManagerWrapper.getInstance();
            aoMgr.setActiveSample(sample);
        }