{"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":"markdown","source":" <div \n     style=\"padding: 20px;\n            color: blach;\n            margin: 0;\n            font-size: 250%;\n            text-align: center;\n            display: fill;\n            border-redius: 5px;\n            back-ground: #f79d28;\n            overflow: hidden;\n            font-wight: 700;\n            border: 5px solid lack;\"\n     >\n    RSNA breast cancer\n    </div>","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nfrom pathlib import Path \nimport pydicom\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-12-08T15:35:01.30495Z","iopub.execute_input":"2022-12-08T15:35:01.305649Z","iopub.status.idle":"2022-12-08T15:35:01.458453Z","shell.execute_reply.started":"2022-12-08T15:35:01.305527Z","shell.execute_reply":"2022-12-08T15:35:01.457562Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file = pydicom.read_file('../input/rsna-breast-cancer-detection/train_images/10006/1459541791.dcm')\nprint(file)\ndata_path = Path('../input/rsna-breast-cancer-detection/train_images/10006')\nsubmission = pd.read_csv('../input/rsna-breast-cancer-detection/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:01.460162Z","iopub.execute_input":"2022-12-08T15:35:01.460476Z","iopub.status.idle":"2022-12-08T15:35:01.61135Z","shell.execute_reply.started":"2022-12-08T15:35:01.460447Z","shell.execute_reply":"2022-12-08T15:35:01.610561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file[0x0028,0x0010]","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:01.613422Z","iopub.execute_input":"2022-12-08T15:35:01.614181Z","iopub.status.idle":"2022-12-08T15:35:01.623257Z","shell.execute_reply.started":"2022-12-08T15:35:01.614147Z","shell.execute_reply":"2022-12-08T15:35:01.622421Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image = file.pixel_array\nplt.figure()\nplt.imshow(image, cmap=\"gray\")","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:01.626192Z","iopub.execute_input":"2022-12-08T15:35:01.627065Z","iopub.status.idle":"2022-12-08T15:35:05.321989Z","shell.execute_reply.started":"2022-12-08T15:35:01.62703Z","shell.execute_reply":"2022-12-08T15:35:05.320709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"all = list(data_path.glob(\"*\"))\nall","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:05.323443Z","iopub.execute_input":"2022-12-08T15:35:05.324236Z","iopub.status.idle":"2022-12-08T15:35:05.336601Z","shell.execute_reply.started":"2022-12-08T15:35:05.324192Z","shell.execute_reply":"2022-12-08T15:35:05.334685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mri_data = []\n\nfor path in all:\n    data = pydicom.read_file(path)\n    mri_data.append(data)","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:05.338291Z","iopub.execute_input":"2022-12-08T15:35:05.338707Z","iopub.status.idle":"2022-12-08T15:35:05.616771Z","shell.execute_reply.started":"2022-12-08T15:35:05.338667Z","shell.execute_reply":"2022-12-08T15:35:05.6156Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"full_volume = []\n\nfor slice in mri_data:\n    full_volume.append(slice.pixel_array)","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:05.618283Z","iopub.execute_input":"2022-12-08T15:35:05.618764Z","iopub.status.idle":"2022-12-08T15:35:10.692271Z","shell.execute_reply.started":"2022-12-08T15:35:05.618731Z","shell.execute_reply":"2022-12-08T15:35:10.691178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axis = plt.subplots(2,2, figsize=(10,10))\n\nslice_counter = 0\nfor i in range(2):\n    for j in range(2):\n        axis[i][j].imshow(full_volume[slice_counter], cmap=\"gray\")\n        slice_counter +=1","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:10.693605Z","iopub.execute_input":"2022-12-08T15:35:10.693933Z","iopub.status.idle":"2022-12-08T15:35:18.959007Z","shell.execute_reply.started":"2022-12-08T15:35:10.693903Z","shell.execute_reply":"2022-12-08T15:35:18.957736Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv(\"submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-12-08T15:35:18.960313Z","iopub.execute_input":"2022-12-08T15:35:18.960739Z","iopub.status.idle":"2022-12-08T15:35:18.971272Z","shell.execute_reply.started":"2022-12-08T15:35:18.9607Z","shell.execute_reply":"2022-12-08T15:35:18.970186Z"},"trusted":true},"execution_count":null,"outputs":[]}]}