GetSync (Serial port interface plugin for ImageJ)

Authors: François GANNIER (gannier at univ-tours dot fr) - Côme PASQUALIN University of Tours (France)
See also: Others productions for ImageJ from the authors
PCCV group main page
History: 2017/04/07: 0.1 - First version
Source: Link to GitHub
Requires: Tested on ImageJ 1.51g but should works on older.
Limitations:Should works on Mac OS, Linux and Windows
Installation:This work is based on the RXTX library and use a short and easy to build electric circuit.
Download the last version of RXTX then copy RXTXcomm.jar in the jars folder and the rxtxserial library (dll, so or jnilib) corresponding to your operating system in the ImageJ directory. (Rq: the plugin was tested with version 2.1.7 and
Download and copy GetSync.jar in the jars folder then restart ImageJ.
Description:This plugin is provided to listen the serial port (COM) on DSR and CTS line, and set state of RTS and DTR.
With it, you can receive signals from 2 separate sources (like synchro and event) and send two distincts TTL command with the corresponding electronical circuit.
Usage in macro:

	// Initialisation
	if (call("GetSync.init",1)==0) {
	// Initialisation failed
		IJ.log("Available serial ports :")
	// Action to do if DSR is ON
	if (call("GetSync.IsDSR")==1) {
		// to do if DSR is ON
	// Action to do if CTS is ON
	if (call("GetSync.IsCTS")==1) {
		// to do if CTS is ON
	// Switch the state of RTS
	// DO NOT FORGET at end to close the serial port
Usage in JAVA: In JAVA, this plugin works in multithreading with the second class listenCOM

	// Initialisation 
	listenCOM sync = new listenCOM();
	//Set the serial port used
	//start the thread
	// test with a time out of 3s
	if (!sync.isStarted(3000)) {
		IJ.showMessage("Warning", "Cannot initialize COM port!!!");
		sync = null;

	//set the RTS line ON
	//test the DSR state
	while (...) {
		if (sync.isDSR()) {
			//todo when synchro come
	// DO NOT FORGET at end to stop the thread (this close serial port)
	sync = null;
Functions in GetSync : ListSerialPorts(); init(int); init(string); done();
isDSR(); isDTS(); isCTS(); isRTS();
setCTS(boolean); setDTR(boolean);
switchRTS(); switchDTR();
Functions in ListenCOM : setPort(int);isStarted((int);
resetCTS(); resetDSR();
switchRTS(); switchDTR();
sendDTR(boolean); sendRTS(boolean);

|Plugins | Home |