Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [chemclipse-dev] Help: display chromatogram during acquisition

When recording the chromatogram, you could use your chromatogram object to display the data and fire the updates, see how the chromatogram editor is created. It requires a file or an IChromatogramMSD instance:

org.eclipse.chemclipse.ux.extension.msd.ui.editors.ChromatogramEditorMSD

    private void loadChromatogram() {

        try {
            /*
             * Import the chromatogram without showing it on the gui. The GUI
             * will take care itself of this action.
             */
            Object object = part.getObject();
            if(object instanceof String) {
                /*
                 * Try to load the chromatogram from file.
                 */
                File file = new File((String)object);
                importChromatogram(file);
            } else if(object instanceof IChromatogramMSD) {
                IChromatogramMSD chromatogram = (IChromatogramMSD)object;
                chromatogramSelection = new ChromatogramSelectionMSD(chromatogram);
                chromatogramFile = null;
            }
        } catch(Exception e) {
            logger.warn(e);
        }
    }

Have a look at the convenient class that helps to open a chromatogram from file or from instance:

org.eclipse.chemclipse.ux.extension.msd.ui.support.ChromatogramEditorSupport

public void openEditor(IChromatogram chromatogram, EModelService modelService, MApplication application, EPartService partService) {
...

Please also check, that the retention time (in milliseconds) is set in each scan of your chromatogram.


Best,
Philip

Am 30.08.2016 um 17:52 schrieb Trig Chen:
Hi all,

I'm developing a plugin in OpenChrom to control our home-made in situ TOF mass spectrometer.
In the device control view, I wrote the following code for the "Acquire data" button:

new Job("Acquisition") {

@Override
protected IStatus run(final IProgressMonitor monitor) {
               final File saveFile = new File("20160830112233.tms");

               // new a empty AbstractChromatogramMSD to hold the acquiring data
               final XmTideTofChromatogram tideMSChromatogram = new XmTideTofChromatogram();
tideMSChromatogram.setFile(saveFile);
final ZipBufferWriter writer = new ZipBufferWriter(saveFile);  // a zip writer to save data to disk
               
               // create ChromatogramEditorMSD part and setObject(tideMSChromatogram)  in UIJob
openMSDEditor(tideMSChromatogram); 

               //acquires scans and adds to tideMSChromatogram
for(int i = 0; i < usbDevice.getSpectraNumber(); i++) {
                        //acquires one scan and adds it to tideMSChromatogram: tideMSChromatogram.addScan(scan), also writes scan data to disk
                       // How to fire update of the ChromatogramEditorMSD ??? 
usbDevice.acquireMassSpectrum(tideMSChromatogram, writer, i);
}
      
               // writes tic and close file in end
writer.writeOverviewFolder(tideMSChromatogram);
}
}.schedule();

When the button clicked, a ChromatogramEditorMSD  part created, but nothing display, just empty figure.

What's wrong with my codes?

Best regards,

Trig


_______________________________________________
chemclipse-dev mailing list
chemclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/chemclipse-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~

Back to the top