Commit 4b718e0c authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

CHG: (solo) EmbryoGen repo established, by doing the following:

DEL: SimViewer has been wiped out from this repo
FIX: .gitignores merged into root one
CHG: DrosoGen's content moved to EmbryoGen's root, DrosoGen folder removed
FIX,CHG: updated CMakeLists.txt (DrosoGen->EmbryoGen) and README.md
parent 2cbc91cb
Pipeline #9873 failed with stages
in 47 seconds
# Compiled C++ object files #
*.o
# Various build folders #
BUILD*
bin*
# Log file, some documentation material #
*.log
doc/Mito*
......
#------------------------------------------------------------------------
#
# Cross platform CMake configure script for 'DrosoGen' simulator
# Cross platform CMake configure script for 'EmbryoGen' simulator
#
# authors: Vladimir Ulman
# Max Planck Institute of Cell Biology and Genetics (c) 2018
#
#------------------------------------------------------------------------
project(DrosoGen)
project(EmbryoGen)
cmake_minimum_required(VERSION 3.1)
include(GNUInstallDirs)
......@@ -69,14 +69,14 @@ set(SOURCES
file(GLOB SCENARIOSOURCES src/Scenarios/*.cpp)
add_executable(drosogen ${SOURCES} ${SCENARIOSOURCES})
add_executable(embryogen ${SOURCES} ${SCENARIOSOURCES})
#--------------------------------------------
# TARGET LINKING - FIRST-LEVEL REQUIRED LIBS
#--------------------------------------------
#if (L_REQUEST_STATIC_LINKING)
# set_target_properties(drosogen PROPERTIES LINK_SEARCH_START_STATIC ON)
# set_target_properties(embryogen PROPERTIES LINK_SEARCH_START_STATIC ON)
#endif (L_REQUEST_STATIC_LINKING)
# i3dlibs library
......@@ -112,7 +112,7 @@ if(NOT ZeroMQ_FOUND)
endif()
# cppzmq header only (that C++-ish wraps around the original libzmq)
find_path(INC_CPPZMQ "zmq.hpp" DOC "DrosoGen, being a C++ project, needs cppzmq (zmq.hpp) installed around libzmq.")
find_path(INC_CPPZMQ "zmq.hpp" DOC "EmbryoGen, being a C++ project, needs cppzmq (zmq.hpp) installed around libzmq.")
include_directories(${INC_CPPZMQ})
#----------------------------------------------
......@@ -158,10 +158,10 @@ if (SEARCH_ALL_DEPLIBS)
endif (SEARCH_ALL_DEPLIBS)
#if (L_REQUEST_STATIC_LINKING)
# set_target_properties(drosogen PROPERTIES LINK_SEARCH_START_STATIC OFF)
# set_target_properties(embryogen PROPERTIES LINK_SEARCH_START_STATIC OFF)
#endif (L_REQUEST_STATIC_LINKING)
#----------------
# TARGET LINKING
#----------------
target_link_libraries(drosogen ${LIBS} libzmq-static)
target_link_libraries(embryogen ${LIBS} libzmq-static)
# Compiled C++ object files #
*.o
# Various build folders #
BUILD*
bin*
# EmbryoGen
![Example: TRAgen3D (C++) sends images to scenerygraphics/scenery (Java + Kotlin)](https://www.fi.muni.cz/~xulman/files/TRAgen-demo/EmbryoGen_earlyVersion.png)
# About
This is [my](http://www.fi.muni.cz/~xulman) next-gen simulator, in which I am
trying to implement the best of from my previous and current work in the field
of simulators/generators for producing realistically looking images for bechmarking
of the image processing, namely cell/nuclei segmentation and tracking.
The simulator can display its progress online via various tools, e.g.
[ZeroMQ](https://github.com/zeromq/libzmq)-ish sends display commands
to a [SimViewer](https://github.com/xulman/SimViewer).
# Installing and starting the simulator
First, resolve all dependecies --- make sure this is installed on your system:
- [CMake](https://cmake.org/)
- [gsl](https://www.gnu.org/software/gsl/)
- [libzmq](https://github.com/zeromq/libzmq) & [cppzmq](https://github.com/zeromq/cppzmq)
- [i3dlibs](https://cbia.fi.muni.cz/software/i3d-library.html)
Second, download, configure, build and run:
```
git clone https://github.com/xulman/EmbryoGen.git
cd EmbryoGen/
mkdir BUILD
cd BUILD/
ccmake ..
make -j4
ln -s ../2013-07-25_1_1_9_0_2_0_0_1_0_0_0_0_9_12.ics
./embryogen randomDrosophila
```
# Compiled Java class files #
*.class
# Package files #
*.war
*.ear
*.zip
*.tar.gz
*.rar
# Maven #
/target
# Eclipse #
/.classpath
/.project
/.settings
# IntelliJ #
/.idea
# About
This is essentially a [Scenery](https://github.com/scenerygraphics/scenery) 'client'
that [ZeroMQ](https://github.com/zeromq/jeromq)-ish listens for and displays current
geometry of the simulated agents. The communication is based on own/proprietary
(and simple) network protocol.
One can find the simulator that feeds this display in the `../DrosoGen` folder.
# Installing and starting this client
```
git clone https://github.com/xulman/EmbryoGen.git
cd EmbryoGen/SimViewer/
mvn dependency:copy-dependencies package
cd target
java -cp "SimViewer-1.0-SNAPSHOT.jar:dependency/*" de.mpicbg.ulman.simviewer.StartUpScene
```
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.mpicbg.ulman.simviewer</groupId>
<artifactId>SimViewer</artifactId>
<version>1.0-SNAPSHOT</version>
<organization>
<name>MPI-CBG</name>
<url>http://www.mpi-cbg.de</url>
</organization>
<name>SimViewer</name>
<description>See README.md</description>
<url>https://github.com/xulman/EmbryoGen</url>
<inceptionYear>2017</inceptionYear>
<packaging>jar</packaging>
<licenses>
<license>
<name>CC0 1.0 Universal License</name>
<url>http://creativecommons.org/publicdomain/zero/1.0/</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>xulman</id>
<name>Vladimír Ulman</name>
<url>http://www.fi.muni.cz/~xulman/</url>
<roles>
<role>founder</role>
<role>lead</role>
<role>developer</role>
<role>debugger</role>
<role>reviewer</role>
<role>support</role>
<role>maintainer</role>
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>None</name>
</contributor>
</contributors>
<mailingLists>
<mailingList>
<name>ImageJ Forum</name>
<archive>http://forum.imagej.net/</archive>
</mailingList>
</mailingLists>
<scm>
<connection>scm:git:git://github.com/xulman/EmbryoGen</connection>
<developerConnection>scm:git:localhost:9999</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/xulman/EmbryoGen</url>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>http://github.com/xulman/EmbryoGen/issues</url>
</issueManagement>
<ciManagement>
<system>None</system>
</ciManagement>
<properties>
<license.licenseName>cc0</license.licenseName>
<license.copyrightOwners>N/A</license.copyrightOwners>
<license.projectName>EmbryoGen</license.projectName>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>imagej.public</id>
<url>http://maven.imagej.net/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.5.1</version>
</dependency>
<dependency>
<groupId>graphics.scenery</groupId>
<artifactId>scenery</artifactId>
<version>0.7.0-beta-3</version>
</dependency>
</dependencies>
</project>
package de.mpicbg.ulman.simviewer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import de.mpicbg.ulman.simviewer.aux.Point;
/**
* Operates on a command line and recognizes a list of commands, try
* 'h<ENTER>' to get a full listing of the commands. The commands
* typically show/hide some type of the recognized graphics that
* the SimViewer can display.
*
* This file was created and is being developed by Vladimir Ulman, 2018.
*/
public class CommandFromCLI implements Runnable
{
private final String initialCommands;
/** constructor to create connection to a displayed window */
public CommandFromCLI(final DisplayScene _scene)
{
scene = _scene;
initialCommands = null;
}
/** constructor to create connection to a displayed window */
public CommandFromCLI(final DisplayScene _scene, final String initCmds)
{
scene = _scene;
initialCommands = initCmds;
}
/** reference on the controlled rendering display */
private final DisplayScene scene;
/** reference on the console input */
private final BufferedReader console = new BufferedReader( new InputStreamReader(System.in) );
/** reference on the currently available FlightRecording: the object
must initialized outside and reference on it is given here, otherwise
the reference must be null */
CommandFromFlightRecorder flightRecorder = null;
/** reads the console and dispatches the commands */
public void run()
{
System.out.println("Key listener: Started.");
try {
if (initialCommands != null)
{
System.out.println("Key listener: Processing initial commands: "+initialCommands);
for (int i=0; i < initialCommands.length(); ++i) processKey(initialCommands.charAt(i));
}
while (true)
{
if (console.ready())
processKey(console.read());
else
Thread.sleep(1000);
}
}
catch (IOException e) {
System.out.println("Key listener: Error reading the console.");
e.printStackTrace();
}
catch (InterruptedException e) {
System.out.println("Key listener: Interrupted and Stopped.");
}
}
private
void processKey(final int key)
throws InterruptedException
{
switch (key)
{
case 'h':
System.out.println("List of accepted commands:");
System.out.println("h - Shows this help message");
System.out.println("q - Quits the program");
System.out.println("o - Overviews the current settings");
System.out.println("p - Toggles usage of the rendering push mode");
System.out.println();
System.out.println("A - Toggles display of the axes in the scene centre");
System.out.println("B - Toggles display of the scene border");
System.out.println("I - Toggles between front/back/both/none ramp lights");
System.out.println("H - Toggles on/off of camera-attached lights");
System.out.println("r,R - Asks Scenery to re-render only-update-signalling/all objects");
System.out.println("s - Saves the current content as a screenshot image");
System.out.println("S - Toggles automatic saving of screenshots (always after vectors update)");
System.out.println();
System.out.println("P - Adds some cells to have something to display");
System.out.println("W - Deletes (Wipes away) all objects (even if not displayed)");
System.out.println("d - Deletes old/not-recently-updated objects (even if not displayed)");
System.out.println("D - Toggle \"garbage collection\" of old/not-recently-updated objects");
System.out.println();
System.out.println("c,C - Toggles display of the cell/general-debug spheres (shape)");
System.out.println("l,L - Toggles display of the cell/general-debug lines");
System.out.println("f,F - Toggles display of the cell/general-debug vectors (forces)");
System.out.println("g,G - Toggles display of the cell-debug/general-debug");
System.out.println("m,M - Disable/Enable culling of front faces (Display/Hide)");
System.out.println("v,V - Decreases/Increases the vector display stretch");
System.out.println();
System.out.println("O filename - Open FlightRecording saved in the given file");
System.out.println("7,0 - Replays the first/last time point from the current FlightRecording");
System.out.println("8,9 - Replays previous/next time point from the current FlightRecording");
break;
case 'o':
scene.reportSettings();
break;
case 'A':
System.out.println("Axes displayed: "+scene.ToggleDisplayAxes());
break;
case 'B':
System.out.println("Scene border displayed: "+scene.ToggleDisplaySceneBorder());
break;
case 'I':
System.out.println("Current ramp lights: "+scene.ToggleFixedLights());
break;
case 'H':
System.out.println("Current head lights: "+scene.ToggleHeadLights());
break;
case 'P':
CreateFakeCells();
System.out.println("Fake cells added");
break;
case 'W':
scene.removeAllObjects();
System.out.println("All objects removed (incl. lines and vectors)");
break;
case 'd':
scene.garbageCollect(1);
System.out.println("Garbage removed (incl. lines and vectors)");
break;
case 'D':
scene.garbageCollecting ^= true;
System.out.println("Garbage collection activated: "+scene.garbageCollecting);
break;
case 'c':
System.out.println("Cell spheres displayed: "+scene.ToggleDisplayCellSpheres());
break;
case 'l':
System.out.println("Cell lines displayed: "+scene.ToggleDisplayCellLines());
break;
case 'f':
System.out.println("Cell vectors displayed: "+scene.ToggleDisplayCellVectors());
break;
case 'C':
System.out.println("General debug spheres displayed: "+scene.ToggleDisplayGeneralDebugSpheres());
break;
case 'L':
System.out.println("General debug lines displayed: "+scene.ToggleDisplayGeneralDebugLines());
break;
case 'F':
System.out.println("General debug vectors displayed: "+scene.ToggleDisplayGeneralDebugVectors());
break;
case 'v':
scene.setVectorsStretch(0.80f * scene.getVectorsStretch());
System.out.println("new vector stretch: "+scene.getVectorsStretch());
break;
case 'V':
scene.setVectorsStretch(1.25f * scene.getVectorsStretch());
System.out.println("new vector stretch: "+scene.getVectorsStretch());
break;
case 'g':
System.out.println("Cell debug displayed: "+scene.ToggleDisplayCellDebug());
break;
case 'G':
System.out.println("General debug displayed: "+scene.ToggleDisplayGeneralDebug());
break;
case 'm':
scene.DisableFrontFaceCulling();
System.out.println("Front faces displayed");
break;
case 'M':
scene.EnableFrontFaceCulling();
System.out.println("Front faces NOT displayed");
break;
case 'r':
scene.scene.updateWorld(true, false);
System.out.println("Scenery refreshed (only those that flag 'update needed')");
break;
case 'R':
scene.scene.updateWorld(true, true);
System.out.println("Scenery refreshed (forcily everyone)");
break;
case 's':
scene.saveNextScreenshot();
System.out.println("Current content (screenshot) just saved into a file");
break;
case 'S':
scene.savingScreenshots ^= true;
System.out.println("Automatic screenshots are now: "+scene.savingScreenshots);
break;
case 'p':
System.out.println("Push node is now: "+scene.TogglePushMode());
break;
case 'O':
if (flightRecorder != null)
{
try {
final String fnString = console.readLine().trim();
if (!fnString.isEmpty())
{
flightRecorder.open(fnString);
System.out.println("Opened this FlightRecording: "+fnString);
flightRecorder.sendNextTimepointMessages();
}
else
System.out.println("Please, specify also the filename, e.g. as \"O flightRecord.dat\"");
}
catch (IOException e) {
System.out.println("Problem opening a FlightRecording, but still continue running....");
e.printStackTrace();
}
}
else System.out.println("FlightRecording is not available.");
break;
case '7':
if (flightRecorder != null)
{
if (!flightRecorder.rewindAndSendFirstTimepoint())
System.out.println("No FlightRecording file is opened.");
}
else System.out.println("FlightRecording is not available.");
break;
case '8':
if (flightRecorder != null)
{
if (!flightRecorder.sendPrevTimepointMessages())
System.out.println("No FlightRecording file is opened.");
}
else System.out.println("FlightRecording is not available.");
break;
case '9':
if (flightRecorder != null)
{
if (!flightRecorder.sendNextTimepointMessages())
System.out.println("No FlightRecording file is opened.");
}
else System.out.println("FlightRecording is not available.");
break;
case '0':
if (flightRecorder != null)
{
if (!flightRecorder.rewindAndSendLastTimepoint())
System.out.println("No FlightRecording file is opened.");
}
else System.out.println("FlightRecording is not available.");
break;
case 'q':
scene.stop();
//don't wait for GUI to tell me to stop
throw new InterruptedException("Key listener: Stopping myself now.");
default:
if (key != '\n') //do not respond to Enter keystrokes
System.out.println("Not recognized command, no action taken");
}
}
void CreateFakeCells()
{
synchronized (scene.lockOnChangingSceneContent)
{
final float xStep = scene.sceneSize[0] / 6.0f;
final float yStep = scene.sceneSize[1] / 6.0f;
final float xCentre = scene.sceneOffset[0] + 0.5f*scene.sceneSize[0];
final float yCentre = scene.sceneOffset[1] + 0.5f*scene.sceneSize[1];
final float zCentre = scene.sceneOffset[2] + 0.5f*scene.sceneSize[2];
final Point c = new Point();
int ID = 0;
for (int y=0; y < 5; ++y)
for (int x=0; x < 5; ++x)
{
//if (x != 2 && y != 2)
{
ID = (x+10*y +1) << 17; //cell ID
ID++; //1st element of this cell
c.centre.set(0, xCentre + xStep*(x-2.0f) -2.0f);