general > RE: Questions regarding using QuickMaskNL for batch processing rat brain samples
Jan 22, 2025  03:01 PM | Gergely Csucs
RE: Questions regarding using QuickMaskNL for batch processing rat brain samples

Hi,


The masking tool is a quick'n'dirty solution, the coordinates are the corners of a triangle from the cutting plane. Usually they're coming from QuickNII:



  • open QuickNII, don't load any series

  • set up the main view in the way how you want to cut the atlas into half

  • read coordinates for 3 suitably distant points, e.g. move the mouse cursor somewhere in the top-left, read the coordinates (they're displayed in the purple title bar), then repeat this with top-right and bottom-center.


So in the given case the atlas is halved along the x=242 plane (all 3 points have this coordinate).


For mass-producing these masks you will have to use the command line, and that can be painful.


Setup:



  • find a convenient location, if you're not familiar with navigating the command line, try creating a new folder in the root of a drive where you have write access (in Windows Explorer, navigate to "This PC" - will be different if Windows is set to German -, and check locations that have a drive letter, like C:, D:, etc.). Let's assume it's M: and the folder is called MaskTest

  • download QNLpack.zip from https://www.nesys.uio.no/QNL/ and extract it. There is a single QNL folder inside, that's the one you will need to copy into the previously created MaskTest folder on the M: drive

  • you will need Java, download it from https://openjdk.org/ - it's not friendly to the eye, but there's a link "jdk.java.net/23" in the middle of the second paragraph, that's where you can find the current downloads). Get the one for Windows, extract it, and right now it contains a jdk-23.0.2 folder, copy that into MaskTest too

  • copy all of the JSON files you want to process into the same MaskTest folder.


So now MaskTest contains QNL and jdk-23.0.2 folders, and lots of JSON files.


Now start a command prompt, like open the Start Menu and type cmd. Probably it will arrive in your user folder, so type the drive letter where you have MaskTest, and a colon, then press Enter. In my case I type m:. Now type cd \MaskTest and press Enter. These two steps set the working location in the command prompt.


Here we can test if the installation works, first try jdk-23.0.2\bin\java --version to see if Java works properly, and then try jdk-23.0.2\bin\java -cp QNL qnlmask.QuickMask to check if QuickMaskNL works too. Then just close it.


If everything worked so far, two steps remain:



  1. creating output folders for every JSON: for %f in (*.json) do mkdir "%~nf"
  2. and running the tool: for %f in (*.json) do jdk-23.0.2\bin\java -cp QNL qnlmask.QuickMask "%f" 242 32.2 292.8 242 367.9 291.8 242 34.5 48.7 "%~nf"

In the download location there's a screenshot of the ideal case too (I processed only 2 files), though it won't do much if anything goes wrong.


I hope this helps, best regards:


Gergely

Threaded View

TitleAuthorDate
Janine Reinert Jan 21, 2025
RE: Questions regarding using QuickMaskNL for batch processing rat brain samples
Gergely Csucs Jan 22, 2025
Janine Reinert Jan 28, 2025