{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"! pip install patchify","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-06-28T15:03:32.15589Z","iopub.execute_input":"2022-06-28T15:03:32.156305Z","iopub.status.idle":"2022-06-28T15:03:43.707797Z","shell.execute_reply.started":"2022-06-28T15:03:32.156269Z","shell.execute_reply":"2022-06-28T15:03:43.706337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from skimage import io, transform\nimport tifffile as tiff\nimport torch\nimport rasterio\nfrom rasterio.windows import Windows","metadata":{"execution":{"iopub.status.busy":"2022-06-28T15:03:43.712458Z","iopub.execute_input":"2022-06-28T15:03:43.712837Z","iopub.status.idle":"2022-06-28T15:03:44.761067Z","shell.execute_reply.started":"2022-06-28T15:03:43.712804Z","shell.execute_reply":"2022-06-28T15:03:44.759844Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_image_patches(image, size, reduce):\n    shape = image.shape\n    _size_ = size*reduce ##  reduced size by amount of reduced . . . (256 * 4 = 1024)\n    pad_y = (_size_ - shape[0] % _size_ )% _size_\n    pad_x = (_size_ - shape[1] % _size_ )% _size_\n    \n    num_y = (shape[0] + pad_y)// _size_  ## number of images in x\n    num_x = (shape[1] + pad_x)// _size_  ## number of images in y\n    \n    \n    \n    \n    ","metadata":{},"execution_count":null,"outputs":[]}]}