- NDPITools (choose NDPITools software version, independent of ImageJ)
- Install MATLAB Engine API for Python
- Other packages for python
data_preparation.sh includes the steps to prepare all nucleus patches for classification.
Explanations of main steps
-
ndpisplituses NDPITools to split the NDPI files into smaller pieces.This should generate 512 jpg images of size 6496*3360px for each slide, indexing from
i01j01toi32j16. (It takes about 1h to split one whole slide.) -
predict_mask.pyis used to infer fuzzy prediction masks for nucleus locations. -
ImageJ macro script
particle_analysis_fixedDirectory.ijm(orparticle_analysis.ijm) is called to run blob analysis and extract the detected nucleus coordinates to CSV files. -
extract_patch.pyis used to cut out nuclei at all z-levels (according to the detected nucleus coordinates in CSV files). -
select_focus.pyis used to select the most focused patch for each nucleus location.Or alternatively,
./select_focus_parallel.sh Ndoes this step using N processes in parallel.
-
Clone this repository to the directory of the NDPI files.
-
There are two options for this step:
-
Edit the path for
inputFolderandoutputFolderinparticle_analysis_fixedDirectory.ijm:inputFolder="/PATH_TO/OralCellDataPreparation/PredMasks/"; outputFolder="/PATH_TO/OralCellDataPreparation/CSVResults/"; -
Or alternatively, replace
ImageJ --headless -macro particle_analysis_fixedDirectory.ijm
with
ImageJ -macro particle_analysis.ijm
in
data_preparation.sh. Then the path forinputFolderandoutputFolderwill need to be selected when prompted.
-
-
Run
cd OralCellDataPreparation ./data_preparation.shThe focused patches will be generated in
/PATH_TO/OralCellDataPreparation/Patches/Z_focused/.Or replace
nohup python3 select_focus.py >./nohup.out 2>./nohup.err &
with
./select_focus_parallel.sh N
to run in parallel, where input argument N is the number of processes.
The progress bar is redirected in
/PATH_TO/OralCellDataPreparation/debugging/*.err, together with the error messages.
- There might be some "imread error". This is due to trying to read some corrupted images. They are handled by being ignored.