{"id":26605769,"url":"https://github.com/ij-plugins/ijp-scala-console","last_synced_at":"2025-07-25T13:06:17.764Z","repository":{"id":57737715,"uuid":"66111995","full_name":"ij-plugins/ijp-scala-console","owner":"ij-plugins","description":"Console for running Scala scripts.","archived":false,"fork":false,"pushed_at":"2024-09-17T22:53:11.000Z","size":7890,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T19:46:47.528Z","etag":null,"topics":["imagej","scala","scala-scripts","scalafx","scalafx-application","scalafx-framework"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ij-plugins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-19T21:00:11.000Z","updated_at":"2024-09-17T22:53:14.000Z","dependencies_parsed_at":"2024-09-18T02:46:13.917Z","dependency_job_id":"08100f33-3a7b-4ade-b99e-805fd424d86a","html_url":"https://github.com/ij-plugins/ijp-scala-console","commit_stats":{"total_commits":114,"total_committers":1,"mean_commits":114.0,"dds":0.0,"last_synced_commit":"d9f5a21ed3dc72fe93b97545089eee9731c9ce81"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ij-plugins/ijp-scala-console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ij-plugins%2Fijp-scala-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ij-plugins%2Fijp-scala-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ij-plugins%2Fijp-scala-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ij-plugins%2Fijp-scala-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ij-plugins","download_url":"https://codeload.github.com/ij-plugins/ijp-scala-console/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ij-plugins%2Fijp-scala-console/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267009809,"owners_count":24020677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imagej","scala","scala-scripts","scalafx","scalafx-application","scalafx-framework"],"created_at":"2025-03-23T21:16:01.690Z","updated_at":"2025-07-25T13:06:17.739Z","avatar_url":"https://github.com/ij-plugins.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"ijp-scala-console\n=================\n\nIJP Scala Console is simple user interface for executing Scala scripts.\n\n[![Actions Status](https://github.com/ij-plugins/ijp-scala-console/workflows/Scala%20CI/badge.svg)](https://github.com/ij-plugins/scala-console/actions)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sf.ij-plugins/scala-console_3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sf.ij-plugins/scala-console_3)\n[![Scaladoc](https://javadoc.io/badge2/net.sf.ij-plugins/scala-console_3/scaladoc.svg)](https://javadoc.io/doc/net.sf.ij-plugins/scala-console_3)\n\n**Contents**\n\n\u003c!-- TOC --\u003e\n\n* [ijp-scala-console](#ijp-scala-console)\n    * [ImageJ Script Examples](#imagej-script-examples)\n    * [ImageJ Plugin Download](#imagej-plugin-download)\n    * [Related Projects](#related-projects)\n    * [License](#license)\n\n\u003c!-- TOC --\u003e\n\nOverview\n--------\n\nThe Scala Console can be run stand-alone, embedded in a desktop application, or [ImageJ] plugin. UI is build with\nScalaFX.\n\n![Screenshot](docs/images/Scala-Console-2_screenshot.png)\n\nImageJ Plugin Download\n----------------------\n\nBinaries can be downloaded from the [releases] page. Extract the binaries to the ImageJ plugins directory. The plugin\nwill be available through ImageJ menu: `Plugins` \u003e `Scripting` \u003e `Scala Console`.\n\nImageJ Script Examples\n----------------------\n\n### Get Access to the Current Image\n\nAssume that you opened an image in ImageJ, for instance, using `File` \u003e `Open Samples` \u003e `Leaf`\n\nThe following script will get a handle to the current activa image (`IJ.getImage`), assign it to a value `imp`, and then\nprint it:\n\n```scala\nimport ij.IJ\n\nval imp = IJ.getImage\nprintln(imp)\n```\n\nNote: if there is no image open a \"No image\" dialog will be shown and execution will be aborted\n\nNote: that the first thing the script does is to import ImageJ's object `IJ` from package `ij`. Object `IJ` contains\nmany\nfrequently used ImageJ methods, like:\n\n* `getImage` - get current image\n* `openImage` - load image from a file\n* `run` - run a plugin or a command\n* `save`  - save current image\n* `setSlice` - select slice in current image\n* `showMessage` - display dialog with a message\n\nFull list can be found here: https://imagej.nih.gov/ij/developer/api/ij/ij/IJ.html\n\nNote: you can use methods contained in `IJ` directly, without prefixing with `IJ`. To do that import a specific method,\nfor instance, `import ij.IJ.getImage` or all the available methods `import ij.IJ.*`. Here is a shorted version of the\nabove example:\n\n```scala\nimport ij.IJ.*\n\nprintln(getImage)\n```\n\n### Run Command \"Median...\" to Process Current Image\n\nYou can execute any menu command using `IJ.run` method and providing command name. In simplest form you only provide\ncommand name, it will run on the current open image:\n\n```scala\nimport ij.IJ.*\n\nrun(\"Median...\")\n```\n\nThe command may open additional dialog asking for options. If you know what options you want to pass you can do that:\n\n```scala\nimport ij.IJ.*\n\nrun(\"Median...\", \"radius=4\")\n```\n\nIf you want to control on which image the command runs, you can do that too:\n\n```scala\nimport ij.IJ.*\n\nval imp = getImage\nrun(imp, \"Median...\", \"radius=4\")\n```\n\nThe options are listed in a single string using names of fields in the dialog. \nFor boolean values, you use only filed name if value is true (checkbox is checked), \nyou skip the field name of value is false.\n\nHint: You can use Macro Recorder (`Plugins` \u003e `Macros` \u003e `Record`) to record a command then copy it to your script.\n\nAdditional example scripts can be found the [examples] directory.\n\n## More examples\n\n#### Create Image of a Sphere\n\nCreates an image of a sphere using discontinuity in \"Red/Green\" lookup table:\n\n```scala\nimport ij.*\nimport ij.process.*\n\ndef sphere(): Unit = {\n  val size = 1024\n  val ip   = new FloatProcessor(size, size)\n  val t0   = System.currentTimeMillis()\n  for (y \u003c- 0 until size) {\n    val dy = y - size / 2\n    for (x \u003c- 0 until size) {\n      val dx = x - size / 2\n      val d  = Math.sqrt(dx * dx + dy * dy).toFloat\n      ip.setf(x, y, -d)\n    }\n  }\n  val time = (System.currentTimeMillis() - t0) / 1000\n  val img  = new ImagePlus(s\"$time seconds\", ip)\n  // Apply \"Red/Green\" lookup table\n  IJ.run(img, \"Red/Green\", \"\")\n  img.show()\n}\n\nsphere()\n```\n![example sphere](docs/images/example_sphere.png)\n\nRelated Projects\n----------------\n\n* [ScalaInterpreterPane] - a Swing component for editing code in the Scala programming language and executing it in an\n  interpreter.\n* [Scala Scripting](https://github.com/scijava/scripting-scala/) - a library providing a JSR-223-compliant scripting\n  plugin for the Scala language, part of [SciJava Script Editor] project. The project support multiple scripting\n  languages. Detailed info can be found at [Using the Script Editor](https://imagej.net/scripting/script-editor) wiki.\n\nLicense\n-------\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation; either\nversion 2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n\n[ImageJ]: http://rsb.info.nih.gov/ij/\n\n[examples]: https://github.com/ij-plugins/ijp-scala-console/tree/main/scala-console/examples\n\n[releases]: https://github.com/ij-plugins/ijp-scala-console/releases\n\n[ScalaInterpreterPane]: https://github.com/Sciss/ScalaInterpreterPane\n\n[SciJava Script Editor]: https://github.com/scijava/script-editor","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fij-plugins%2Fijp-scala-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fij-plugins%2Fijp-scala-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fij-plugins%2Fijp-scala-console/lists"}