diff --git a/README.md b/README.md index 202bb8c..d40c2f0 100644 --- a/README.md +++ b/README.md @@ -9,44 +9,13 @@ Intensity-based registration algorithm repository: https://github.com/uw-loci/sh ||| ## Required packages -Install required packages in a virtual environment, commands for anaconda/miniconda (https://www.anaconda.com/distribution/) are listed -* python==3.6.x +Install [anaconda/miniconda](https://docs.conda.io/en/latest/miniconda.html) +Required packages ``` - conda create --name [NAME_ENV] python=3.6 - conda activate [NAME_ENV] + $ conda env create --name syn --file env.yml + $ conda activate syn ``` -* matplotlib==3.1.2 -``` - conda install -c conda-forge matplotlib=3.1.2 -``` -* numpy==1.17.4 -``` - conda install -c anaconda numpy=1.17.4 -``` -* pandas==0.25.3 -``` - conda install -c anaconda pandas=0.25.3 -``` -* Pillow==5.3.0 -``` - conda install -c anaconda pillow=5.3.0 -``` -* pyimagej==0.4.0 -``` -conda install -c conda-forge pyimagej -``` -* scikit-image==0.16.2 -``` - conda install -c anaconda scikit-image=0.16.2 -``` -* tqdm==4.42.0 -``` - conda install -c conda-forge tqdm=4.42.0 -``` -* pytorch>=1.3.1 -``` - conda install pytorch torchvision cudatoolkit=10.1 -c pytorch -``` + ## Download example testing data, trained model weights, FIJI Execute download.py ``` diff --git a/main.py b/main.py index 32821c6..7611cfd 100644 --- a/main.py +++ b/main.py @@ -69,7 +69,7 @@ def main(): parser.add_argument('--load-multiple-gpu-weights', type=int, default=1, help='1: multiple gpu weights, 0: single gpu weghts') parser.add_argument('--input-folder', type=str, default='default', help='input_test + _FOLDERNAME') parser.add_argument('--intensity', type=tuple, default=(20, 180), help='output intensity rescale') - parser.add_argument('--pilot', type=int, default=0, help='1: only process the first image, 0: process all images') + parser.add_argument('--pilot', type=int, default=1, help='1: only process the first image, 0: process all images') args = parser.parse_args() @@ -104,7 +104,7 @@ def demo(args): model.to(device) print('loading ImageJ, please wait') - ij = imagej.init('fiji/fiji/Fiji.app/') + ij = imagej.init('fiji/Fiji.app/') # use for SHG TASK = args.input_folder @@ -165,6 +165,7 @@ def demo(args): io.imsave(OUTPUT_PATCH_DIR+img_name, result_patch) print('stitching, please wait...') + os.makedirs(CHANNEL_DIR, exist_ok=True) params = {'type': 'Positions from file', 'order': 'Defined by TileConfiguration', 'directory':OUTPUT_PATCH_DIR, 'ayout_file': 'TileConfiguration.txt', 'fusion_method': 'Linear Blending', 'regression_threshold': '0.30', @@ -172,7 +173,7 @@ def demo(args): 'compute_overlap':False, 'computation_parameters': 'Save computation time (but use more RAM)', 'image_output': 'Write to disk', 'output_directory': CHANNEL_DIR} plugin = "Grid/Collection stitching" - ij.py.run_plugin(plugin, params) + ij.py.run_plugin(plugin, params) output_name = os.path.join(OUTPUT_DIR, fn) listOfChannels = [f for f in os.listdir(CHANNEL_DIR)] @@ -180,10 +181,11 @@ def demo(args): c1 = c1[:img.shape[0], :img.shape[1]] c1 = img_as_ubyte(c1) c1 = exposure.rescale_intensity(c1, in_range=args.intensity, out_range=(0, 255)) + c1 = exposure.rescale_intensity(c1, in_range=(0, 255), out_range=(0, 1)) print(str(k+1)+"/" + str(len(files)) + " output saved as: " + output_name) io.imsave(output_name, img_as_ubyte(c1)) if args.pilot: break if __name__ == '__main__': - main() + main() \ No newline at end of file