This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
creating_multiple_cases [2024/02/15 17:36] chris |
creating_multiple_cases [2024/02/29 14:50] (current) chris |
||
---|---|---|---|
Line 24: | Line 24: | ||
==Situation 2== | ==Situation 2== | ||
- | - All your WSI's are loose in a directory, and each WSI is it's own Case. | + | - Your WSI's are loose in one or more folders, and you want to add one or several WSI's as their own Case i.e. File1.tif should become Case1, File2.jpg should become Case 2... |
- | Currently Pathotrainer only detects folders as cases, so we've written a quick script for Windows Command Prompt that will help you get your WSIs in an organised state. | + | In this scenario you have a couple of options: |
- | **If you're using a filetype with just one file per WSI e.g. .dcm, .ndpi:** | + | 1) You can use a [[creating cases using pattern search|pattern search with regular expression to fish out the right files and put them in the right case]] |
- | Step 1: Open Command Prompt (type CMD into the windows search bar and open the app)\\ | + | -or- |
- | Step 2: Navigate in Command Prompt to the folder with the WSIs. This is done by typing "cd" and then pasting the path to the folder. Then press enter.\\ | + | 2) You can use two or three easy Windows command prompts to [[quickly_creating_subfolders_for_multiple_cases|make a Case subfolder for every WSI in a folder and move them into it. You can follow the walkthrough with pictures here.]] |
- | + | ||
- | Step 3: Now that you're in the right folder, copy and paste: **for %i in (*) do mkdir "%~ni"** then hit enter. Running this command will make a subfolder for every file, with the same as the file.\\ | + | |
- | + | ||
- | Step 4: Copy and paste then enter: **for %i in (*) do move "%i" "%~ni"** | + | |
- | + | ||
- | {{ :add_multiple_cases_3.png?800 |}} | + | |
- | + | ||
- | **If you're using a folder-based filetype e.g. .mrxs that has a folder and a file with the same name** | + | |
- | + | ||
- | Step 1: Open Command Prompt (type CMD into the windows search bar and open the app)\\ | + | |
- | + | ||
- | Step 2: Navigate in Command Prompt to the folder with the WSIs. This is done by typing "cd" and then pasting the path to the folder. Then press enter.\\ | + | |
- | + | ||
- | Step 3: Now that you're in the right folder, copy and paste: **for /d %i in (*) do mkdir "%i_temp"** then hit enter. Running this command will make a new folder for every folder in the directory, with the same name as the folder + "_temp".\\ | + | |
- | + | ||
- | Step 4: Copy and paste then enter:\\ **for /d %i in (*) do ( \\ | + | |
- | if /i not "%i"=="%i_temp" ( \\ | + | |
- | move "%i" "%i_temp\" \\ | + | |
- | ) \\ | + | |
- | )** | + | |
- | + | ||
- | This will copy all your existing folders into the newly created "_temp" folders. | + | |
- | + | ||
- | Step 5: Copy and execute **for %i in (*) do move "%i" "%~ni_temp"** \\ | + | |
- | This will move all the loose files into the directory with the same name plus "_temp" | + | |
- | + | ||
- | {{ :add_multiple_cases_4.png?800 |}} | + | |
- | + | ||
- | Please note that: | + | |
- | - You can adjust the three "_temp" in all three commands to whatever addition you'd like, however it must be exactly the same for all three commands. | + | |
- | - This script only works when the folder and the file both have exactly the same name - if this is not the case you will need to devise a custom script as we cannot anticipate all naming conventions. | + | |
- | - If you have multiple WSIs that have to go into the same case, you will need to devise a custom script as we cannot anticipate what your combination of WSIs per case is. | + |