{"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":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport itertools\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\n#import os\n#for dirname, _, filenames in os.walk('/kaggle/input'):\n#    for filename in filenames:\n#        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-05-27T15:40:02.972593Z","iopub.execute_input":"2021-05-27T15:40:02.972955Z","iopub.status.idle":"2021-05-27T15:40:14.994419Z","shell.execute_reply.started":"2021-05-27T15:40:02.972922Z","shell.execute_reply":"2021-05-27T15:40:14.993325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"First we are going to try to take the first input and transform it into a picture that Flos algorithm can work with.","metadata":{}},{"cell_type":"code","source":"#list(itertools.islice(os.walk('/kaggle/input/siim-covid19-detection/train'),1))\n#print(os.listdir('/kaggle/input/siim-covid19-detection/train/cd5dd5e6f3f5/b2ee36aa2df5'))\n\nimport matplotlib.pyplot as plt\nimport pydicom \nfrom PIL import Image\n\nimg = pydicom.dcmread('/kaggle/input/siim-covid19-detection/train/cd5dd5e6f3f5/b2ee36aa2df5/d8ba599611e5.dcm')\n\nvalues = img.pixel_array\nprint(values.shape[0])\n\n\nrgbvalues = (values*(256/32768)).astype('uint8')\n\nrgbvalues = np.stack((rgbvalues,rgbvalues,rgbvalues),axis = 2)\n\nplt.imshow(values, cmap=plt.cm.gray)\n#plt.imshow(rgbvalues)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-05-27T15:53:45.697584Z","iopub.execute_input":"2021-05-27T15:53:45.697957Z","iopub.status.idle":"2021-05-27T15:53:46.559018Z","shell.execute_reply.started":"2021-05-27T15:53:45.697922Z","shell.execute_reply":"2021-05-27T15:53:46.557614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport pydicom \nfrom PIL import Image\n\nratios = np.array([])\nfor dirname, _, filenames in os.walk('/kaggle/input/siim-covid19-detection/train'):\n    for filename in filenames:\n        if os.path.join(dirname, filename)[-1] == 'm':\n            file_path = os.path.join(dirname, filename)\n            print(file_path)\n            dicom = pydicom.read_file(file_path, stop_before_pixels=False)\n            #img = pydicom.dcmread(os.path.join(dirname, filename))\n            values = dicom.pixel_array\n            #np.append(ratios,np.array([values.shape[1]/values.shape[0]]))\n            \n#print(ratios.min, ratios.max)\n#print(ratio.mean, ratios.std)","metadata":{"execution":{"iopub.status.busy":"2021-05-27T16:05:48.911992Z","iopub.execute_input":"2021-05-27T16:05:48.912317Z","iopub.status.idle":"2021-05-27T16:05:49.30953Z","shell.execute_reply.started":"2021-05-27T16:05:48.912286Z","shell.execute_reply":"2021-05-27T16:05:49.308336Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"asdf = 1234\njkl = 345","metadata":{},"execution_count":null,"outputs":[]}]}