diff --git a/_includes/string_concat/activities/string_concat.md b/_includes/string_concat/activities/string_concat.md deleted file mode 100644 index 72d0601e..00000000 --- a/_includes/string_concat/activities/string_concat.md +++ /dev/null @@ -1,15 +0,0 @@ -### String concatenation -- Open a script editor. -- Create a log message - - Define two variables: `i` with value `11` and `n` with value `100`. - - Using those two variables create the message: `"Analyzing image 11/100..."`. -- Create a file path - - Use an in-built function to print the string that separates folders on your operating system - - Get the temp folder on your system and store it in a variable - - Create a path to a hypothetical file in the temp folder with the help of the separator string -- Explore the escape string `\` - - Print `\`, depending on the language that may be a little challenge. - - Print the string `"\"` (it should actually print the quotation marks!) - - Create a string with two sentences and a line break. - - Print tab separated values. - \ No newline at end of file diff --git a/_includes/string_concat/activities/string_concat_imagejmacro.ijm b/_includes/string_concat/activities/string_concat_imagejmacro.ijm deleted file mode 100644 index 4cc24b03..00000000 --- a/_includes/string_concat/activities/string_concat_imagejmacro.ijm +++ /dev/null @@ -1,19 +0,0 @@ -// log message -i = 11; -n = 100; -print("Analyzing image "+i+"/"+n+"..."); - -// paths -tmpFolder = getDirectory("temp"); -fileName = "nuclei.tif"; -path = tmpFolder + File.separator + fileName; -print(path); - -// escape character and special characters -print("\\"); // print("\"); will throw an error - -print("\"\\\""); - -print("Line 1.\nLine 2."); - -print("1\t2\t3"); diff --git a/_includes/string_concat/activities/string_concat_python.py b/_includes/string_concat/activities/string_concat_python.py deleted file mode 100644 index edb39742..00000000 --- a/_includes/string_concat/activities/string_concat_python.py +++ /dev/null @@ -1,13 +0,0 @@ -#defining variables -#Please note that in Python, unlike imageJ macro language you cannot concatenate strings directly with numbers. - - -text1 = "Hello " -text2 = "user number " -text3 = "50" - -#concatenating strings -text3 = text1 + text2 + text3 - -#printing the results -print(text3) diff --git a/_includes/string_concat/creating_log_messages.ijm b/_includes/string_concat/creating_log_messages.ijm new file mode 100644 index 00000000..0736b1b7 --- /dev/null +++ b/_includes/string_concat/creating_log_messages.ijm @@ -0,0 +1,4 @@ +// create a log message +imageIndex = 11; +numImages = 100; +print("Analyzing image "+imageIndex+"/"+numImages+"..."); diff --git a/_includes/string_concat/creating_log_messages.md b/_includes/string_concat/creating_log_messages.md new file mode 100644 index 00000000..92cdd7f7 --- /dev/null +++ b/_includes/string_concat/creating_log_messages.md @@ -0,0 +1,6 @@ +

Creating log messages

+- Open a script editor +- Define two variables: + - index of the hypothetially currently processed image with value `11` + - the total number of images to be processed with value `100`. +- Using those two variables create the message: `"Analyzing image 11/100..."`. diff --git a/_includes/string_concat/creating_log_messages.py b/_includes/string_concat/creating_log_messages.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/_includes/string_concat/creating_log_messages.py @@ -0,0 +1 @@ +# TODO diff --git a/_includes/string_concat/manipulating_file_paths.ijm b/_includes/string_concat/manipulating_file_paths.ijm new file mode 100644 index 00000000..5426de7d --- /dev/null +++ b/_includes/string_concat/manipulating_file_paths.ijm @@ -0,0 +1,5 @@ +// manipulating file paths +tmpFolder = getDirectory("temp"); +fileName = "nuclei.tif"; +path = tmpFolder + File.separator + fileName; +print(path); diff --git a/_includes/string_concat/manipulating_file_paths.md b/_includes/string_concat/manipulating_file_paths.md new file mode 100644 index 00000000..b6aaef27 --- /dev/null +++ b/_includes/string_concat/manipulating_file_paths.md @@ -0,0 +1,5 @@ +

Manipulate file paths

+ +In bioimage analysis, one very often opens one image and then needs to save a segmentation (label mask file) and segmented object measurements (a table file). To this end, it is useful if the output images have similar names than the input image, such that one knows that they belong to each other. Sometimes it is useful for those output files to be placed in the same folder as the input image, but often you want to specify a dedicated output folder. + +To manage all these scenarios it is critical to learn how to manipulate file and folder paths in various ways and thereby construct the output paths from the input path and a given output directory. diff --git a/_includes/string_concat/manipulating_file_paths.py b/_includes/string_concat/manipulating_file_paths.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/_includes/string_concat/manipulating_file_paths.py @@ -0,0 +1 @@ +# TODO