Skip to content

Commit

Permalink
bugfixed python code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Aug 15, 2020
1 parent 556bc80 commit ffb0996
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String push(ImagePlus source) {
"image = imread(\"" + filename.replace("\\", "/") + "\")\n\n"+

"# Push " + source.getTitle() + " to GPU memory\n" +
"image1 = cle.push(image)\n";
makeImageID(source) + " = cle.push(image)\n";


program = program.replace("\n", "\n" + line_start );
Expand Down Expand Up @@ -84,9 +84,14 @@ public String execute(IncubatorPlugin plugin) {
program = program + methodName + "(" + image1 + ", " + image2 + call + ")\n";

if (use_napari) {
String scale = calibration.pixelHeight + ", " + calibration.pixelWidth;
if (plugin.getTarget().getNSlices() > 1) {
scale = calibration.pixelDepth + ", " + calibration.pixelHeight + ", " + calibration.pixelWidth;
}

program = program +
"# show result\n\n" +
"viewer.add_image(cle.pull(" + image2 + "), scale=(" + calibration.pixelDepth + ", " + calibration.pixelHeight + ", " + calibration.pixelWidth + "))\n\n";
"viewer.add_image(cle.pull(" + image2 + "), scale=(" + scale + "))\n\n";
} else {
program = program +
"# show result\n\n" +
Expand Down Expand Up @@ -123,10 +128,11 @@ public String header() {
"# > conda activate te_oki \n" +
"# install dependencies: \n" +
"# > pip install pyopencl napari matplotlib numpy pyclesperanto_prototype \n" +
"# Also make sure conda is part of the PATH variable.\n" +
"# \n" +
"# If you want to run it from Fiji, configure conda in Fijis main menu \n" +
"# If you want to run it from Fiji and you're using a different conda environment, you can configure it in Fijis main menu \n" +
"# Plugins > ImageJ on GPU (CLIJx-Incubator) > Options >Conda configuration (Te Oki) \n" +
"# Furtermore, activate the scripting language Te Oki in Fijis script editor to run this script.\n\n" +
"# Furthermore, activate the scripting language Te Oki in Fijis script editor to run this script.\n\n" +
"# Stay tuned and check out http://clesperanto.net to learn more." +
"\n\n" +
"import pyclesperanto_prototype as cle\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public class TeOkiConfigurationDialog implements PlugIn {
@Override
public void run(String arg) {
GenericDialogPlus gdp = new GenericDialogPlus("Te Oki Configuration");
gdp.addDirectoryField("Conda directory", TeOkiEngine.conda_directory);
//gdp.addDirectoryField("Conda directory", TeOkiEngine.conda_directory);
gdp.addStringField("Conda environment", TeOkiEngine.conda_env);
gdp.showDialog();

if (gdp.wasCanceled()) {
return;
}

TeOkiEngine.conda_directory = gdp.getNextString();
//TeOkiEngine.conda_directory = gdp.getNextString();
TeOkiEngine.conda_env = gdp.getNextString();
}
}
4 changes: 2 additions & 2 deletions src/main/java/net/haesleinhuepf/clijx/te_oki/TeOkiEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
public class TeOkiEngine extends IJ1MacroEngine {

public static String teOkiDirectory = null;
public static String conda_directory = "C:\\Users\\rober\\miniconda3";
//public static String conda_directory = "";
public static String conda_env = "te_oki";


Expand All @@ -76,7 +76,7 @@ public void run() {
String conda_code;

if (isWindows) {
conda_code = "call " + conda_directory + "\\Scripts\\activate.bat " + conda_directory + "\n" +
conda_code = //"call " + conda_directory + "\\Scripts\\activate.bat " + conda_directory + "\n" +
"call conda activate " + conda_env + "\n" +
"cd " + directory + "\n" +
"ipython --gui=qt temp.py";
Expand Down

0 comments on commit ffb0996

Please sign in to comment.