diff --git a/scripts/InitializationNotebook.ipynb b/scripts/InitializationNotebook.ipynb index a3572bd..a23371a 100644 --- a/scripts/InitializationNotebook.ipynb +++ b/scripts/InitializationNotebook.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 4, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -16,6 +16,8 @@ "import re\n", "import os, os.path\n", "from os.path import splitext\n", + "import pathlib\n", + "import tqdm\n", "import pydicom as dicom\n", "import numpy as np\n", "from pydicom.uid import UID, generate_uid\n", @@ -33,30 +35,31 @@ "import math\n", "import torch\n", "import torchvision\n", + "import scipy\n", "\n", "sys.path.append(\"..\")\n", "import echonet\n", "\n", "import wget \n", "\n", - "#destinationFolder = \"/Users/davidouyang/Dropbox/Echo Research/CodeBase/Output\"\n", - "destinationFolder = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\Output\"\n", - "#videosFolder = \"/Users/davidouyang/Dropbox/Echo Research/CodeBase/a4c-video-dir\"\n", - "videosFolder = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\a4c-video-dir\"\n", - "#DestinationForWeights = \"/Users/davidouyang/Dropbox/Echo Research/CodeBase/EchoNetDynamic-Weights\"\n", - "DestinationForWeights = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\EchoNetDynamic-Weights\"" + "destinationFolder = \"\"\n", + "#destinationFolder = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\Output\"\n", + "videosFolder = \"\"\n", + "# videosFolder = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\a4c-video-dir\"\n", + "DestinationForWeights = \"\"\n", + "# DestinationForWeights = \"C:\\\\Users\\\\Windows\\\\Dropbox\\\\Echo Research\\\\CodeBase\\\\EchoNetDynamic-Weights\"" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "The weights are at C:\\Users\\Windows\\Dropbox\\Echo Research\\CodeBase\\EchoNetDynamic-Weights\n", + "The weights are at /Users/akn/Drive/Developer/TTE-ML/weights\n", "Segmentation Weights already present\n", "EF Weights already present\n" ] @@ -91,24 +94,32 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 17, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\r", + " 0%| | 0/1 [00:00 0), img[0, :, :, 112:])\n", - "\n", " img = np.concatenate((img, np.zeros_like(img)), 2)\n", - " size = (logit > 0).sum(2).sum(1)\n", + " size = (logit > 0).sum((1, 2))\n", + " \n", " try:\n", " trim_min = sorted(size)[round(len(size) ** 0.05)]\n", " except:\n", @@ -260,8 +324,15 @@ " img[:, x, a + int(round(115 + 100 * y)), b + int(round(x / len(size) * 200 + 10))] = 255.\n", " if x in peaks:\n", " img[:, :, 200:225, b + int(round(x / len(size) * 200 + 10))] = 255.\n", - " echonet.utils.savevideo(os.path.join(destinationFolder, \"videos\", filename[i]), img.astype(np.uint8), 50) " + " echonet.utils.savevideo(os.path.join(destinationFolder, \"videos\", filename[i]), img.astype(np.uint8), 50) " ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -280,7 +351,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.7.6" } }, "nbformat": 4,