Commit 5251b37f authored by Lafnoune Imane's avatar Lafnoune Imane
Browse files

Mise à jour Imane Branch

parent a1578b94
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"https://pydicom.github.io/pydicom/stable/tutorials/dataset_basics.html\n",
"Utile pour le rapport:\n",
"http://www.dimitripianeta.fr/documents/traitements/comprendre%20les%20m%C3%A9tadonn%C3%A9es%20.pdf"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"input_directory='../osic-pulmonary-fibrosis-progression'\n",
"patient = 'ID00419637202311204720264'\n",
"image = '10.dcm'\n",
"path = f'{input_directory}/train/{patient}/{image}'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Dataset.file_meta -------------------------------\n",
"(0002, 0000) File Meta Information Group Length UL: 200\n",
"(0002, 0001) File Meta Information Version OB: b'\\x00\\x01'\n",
"(0002, 0002) Media Storage SOP Class UID UI: CT Image Storage\n",
"(0002, 0003) Media Storage SOP Instance UID UI: 2.25.15591725989708101768360543306906204110\n",
"(0002, 0010) Transfer Syntax UID UI: Explicit VR Little Endian\n",
"(0002, 0012) Implementation Class UID UI: 1.2.276.0.7230010.3.0.3.6.1\n",
"(0002, 0013) Implementation Version Name SH: 'OSIRIX_361'\n",
"(0002, 0016) Source Application Entity Title AE: 'ANONYMOUS'\n",
"-------------------------------------------------\n",
"(0008, 0005) Specific Character Set CS: 'ISO_IR 100'\n",
"(0008, 0008) Image Type CS: ['ORIGINAL', 'PRIMARY', 'AXIAL']\n",
"(0008, 0018) SOP Instance UID UI: 2.25.15591725989708101768360543306906204110\n",
"(0008, 0060) Modality CS: 'CT'\n",
"(0008, 0070) Manufacturer LO: 'PACSGEAR'\n",
"(0008, 1090) Manufacturer's Model Name LO: 'LightSpeed VCT'\n",
"(0010, 0010) Patient's Name PN: 'ID00419637202311204720264'\n",
"(0010, 0020) Patient ID LO: 'ID00419637202311204720264'\n",
"(0010, 0040) Patient's Sex CS: ''\n",
"(0012, 0063) De-identification Method LO: 'Table;'\n",
"(0018, 0015) Body Part Examined CS: 'Chest'\n",
"(0018, 0050) Slice Thickness DS: \"1.25\"\n",
"(0018, 0060) KVP DS: \"120.0\"\n",
"(0018, 1110) Distance Source to Detector DS: \"949.075012\"\n",
"(0018, 1111) Distance Source to Patient DS: \"541.0\"\n",
"(0018, 1120) Gantry/Detector Tilt DS: \"0.0\"\n",
"(0018, 1130) Table Height DS: \"197.0\"\n",
"(0018, 1140) Rotation Direction CS: 'CW'\n",
"(0018, 1151) X-Ray Tube Current IS: \"301\"\n",
"(0018, 1170) Generator Power IS: \"36000\"\n",
"(0018, 1190) Focal Spot(s) DS: \"0.7\"\n",
"(0018, 1210) Convolution Kernel SH: 'BONEPLUS'\n",
"(0018, 5100) Patient Position CS: 'FFS'\n",
"(0020, 000d) Study Instance UID UI: 2.25.24142809421030670533829469959522337181\n",
"(0020, 000e) Series Instance UID UI: 2.25.72922870310959542985933229225637751168\n",
"(0020, 0010) Study ID SH: ''\n",
"(0020, 0013) Instance Number IS: \"10\"\n",
"(0020, 0020) Patient Orientation CS: ''\n",
"(0020, 0032) Image Position (Patient) DS: [-212.600, -170.700, -54.000]\n",
"(0020, 0037) Image Orientation (Patient) DS: [1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]\n",
"(0020, 0052) Frame of Reference UID UI: 2.25.87733149435852076944786005695371983233\n",
"(0020, 1040) Position Reference Indicator LO: 'SN'\n",
"(0020, 1041) Slice Location DS: \"-54.0\"\n",
"(0028, 0002) Samples per Pixel US: 1\n",
"(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'\n",
"(0028, 0010) Rows US: 1100\n",
"(0028, 0011) Columns US: 888\n",
"(0028, 0030) Pixel Spacing DS: [0.820312, 0.820312]\n",
"(0028, 0100) Bits Allocated US: 16\n",
"(0028, 0101) Bits Stored US: 16\n",
"(0028, 0102) High Bit US: 15\n",
"(0028, 0103) Pixel Representation US: 1\n",
"(0028, 0120) Pixel Padding Value US: 63536\n",
"(0028, 1050) Window Center DS: \"-500.0\"\n",
"(0028, 1051) Window Width DS: \"-1500.0\"\n",
"(0028, 1052) Rescale Intercept DS: \"0.0\"\n",
"(0028, 1053) Rescale Slope DS: \"1.0\"\n",
"(0028, 1054) Rescale Type LO: 'HU'\n",
"(7fe0, 0010) Pixel Data OW: Array of 1953600 elements"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pydicom\n",
"\n",
"ds = pydicom.filereader.dcmread(path)\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0018, 1111) Distance Source to Patient DS: \"541.0\""
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem = ds[0x0018, 0x1111]\n",
"elem"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'DistanceSourceToPatient'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem.keyword"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"541.0\""
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem.value"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0018, 1111) Distance Source to Patient DS: \"541.0\""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds['DistanceSourceToPatient']"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"541.0\""
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.DistanceSourceToPatient"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:markdown id: tags:
https://pydicom.github.io/pydicom/stable/tutorials/dataset_basics.html
Utile pour le rapport:
http://www.dimitripianeta.fr/documents/traitements/comprendre%20les%20m%C3%A9tadonn%C3%A9es%20.pdf
%% Cell type:code id: tags:
``` python
input_directory='../osic-pulmonary-fibrosis-progression'
patient = 'ID00419637202311204720264'
image = '10.dcm'
path = f'{input_directory}/train/{patient}/{image}'
```
%% Cell type:code id: tags:
``` python
import pydicom
ds = pydicom.filereader.dcmread(path)
ds
```
%%%% Output: execute_result
Dataset.file_meta -------------------------------
(0002, 0000) File Meta Information Group Length UL: 200
(0002, 0001) File Meta Information Version OB: b'\x00\x01'
(0002, 0002) Media Storage SOP Class UID UI: CT Image Storage
(0002, 0003) Media Storage SOP Instance UID UI: 2.25.15591725989708101768360543306906204110
(0002, 0010) Transfer Syntax UID UI: Explicit VR Little Endian
(0002, 0012) Implementation Class UID UI: 1.2.276.0.7230010.3.0.3.6.1
(0002, 0013) Implementation Version Name SH: 'OSIRIX_361'
(0002, 0016) Source Application Entity Title AE: 'ANONYMOUS'
-------------------------------------------------
(0008, 0005) Specific Character Set CS: 'ISO_IR 100'
(0008, 0008) Image Type CS: ['ORIGINAL', 'PRIMARY', 'AXIAL']
(0008, 0018) SOP Instance UID UI: 2.25.15591725989708101768360543306906204110
(0008, 0060) Modality CS: 'CT'
(0008, 0070) Manufacturer LO: 'PACSGEAR'
(0008, 1090) Manufacturer's Model Name LO: 'LightSpeed VCT'
(0010, 0010) Patient's Name PN: 'ID00419637202311204720264'
(0010, 0020) Patient ID LO: 'ID00419637202311204720264'
(0010, 0040) Patient's Sex CS: ''
(0012, 0063) De-identification Method LO: 'Table;'
(0018, 0015) Body Part Examined CS: 'Chest'
(0018, 0050) Slice Thickness DS: "1.25"
(0018, 0060) KVP DS: "120.0"
(0018, 1110) Distance Source to Detector DS: "949.075012"
(0018, 1111) Distance Source to Patient DS: "541.0"
(0018, 1120) Gantry/Detector Tilt DS: "0.0"
(0018, 1130) Table Height DS: "197.0"
(0018, 1140) Rotation Direction CS: 'CW'
(0018, 1151) X-Ray Tube Current IS: "301"
(0018, 1170) Generator Power IS: "36000"
(0018, 1190) Focal Spot(s) DS: "0.7"
(0018, 1210) Convolution Kernel SH: 'BONEPLUS'
(0018, 5100) Patient Position CS: 'FFS'
(0020, 000d) Study Instance UID UI: 2.25.24142809421030670533829469959522337181
(0020, 000e) Series Instance UID UI: 2.25.72922870310959542985933229225637751168
(0020, 0010) Study ID SH: ''
(0020, 0013) Instance Number IS: "10"
(0020, 0020) Patient Orientation CS: ''
(0020, 0032) Image Position (Patient) DS: [-212.600, -170.700, -54.000]
(0020, 0037) Image Orientation (Patient) DS: [1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
(0020, 0052) Frame of Reference UID UI: 2.25.87733149435852076944786005695371983233
(0020, 1040) Position Reference Indicator LO: 'SN'
(0020, 1041) Slice Location DS: "-54.0"
(0028, 0002) Samples per Pixel US: 1
(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'
(0028, 0010) Rows US: 1100
(0028, 0011) Columns US: 888
(0028, 0030) Pixel Spacing DS: [0.820312, 0.820312]
(0028, 0100) Bits Allocated US: 16
(0028, 0101) Bits Stored US: 16
(0028, 0102) High Bit US: 15
(0028, 0103) Pixel Representation US: 1
(0028, 0120) Pixel Padding Value US: 63536
(0028, 1050) Window Center DS: "-500.0"
(0028, 1051) Window Width DS: "-1500.0"
(0028, 1052) Rescale Intercept DS: "0.0"
(0028, 1053) Rescale Slope DS: "1.0"
(0028, 1054) Rescale Type LO: 'HU'
(7fe0, 0010) Pixel Data OW: Array of 1953600 elements
%% Cell type:code id: tags:
``` python
elem = ds[0x0018, 0x1111]
elem
```
%%%% Output: execute_result
(0018, 1111) Distance Source to Patient DS: "541.0"
%% Cell type:code id: tags:
``` python
elem.keyword
```
%%%% Output: execute_result
'DistanceSourceToPatient'
%% Cell type:code id: tags:
``` python
elem.value
```
%%%% Output: execute_result
"541.0"
%% Cell type:code id: tags:
``` python
ds['DistanceSourceToPatient']
```
%%%% Output: execute_result
(0018, 1111) Distance Source to Patient DS: "541.0"
%% Cell type:code id: tags:
``` python
ds.DistanceSourceToPatient
```
%%%% Output: execute_result
"541.0"
%% Cell type:code id: tags:
``` python
```
# Projet_FR
https://www.kaggle.com/c/osic-pulmonary-fibrosis-progression
## Set up the environment
Commandes bash pour créer un environnement virtuel, y installer les librairies nécessaires, et le package du projet :
```bash
#create virtual environment
python3 -m venv venvfr
source venvfr/bin/activate
pip install poetry
#install dependencies
cd filrouge/
make build
pip uninstall numpy #answer yes
pip install numpy==1.20.3
#register kernel
python -m ipykernel install --name venvfr
```
on peut alors appeler les fonctions depuis un notebook démarré avec le kernel de l'environnement virtuel:
```bash
from filrouge.preprocessing.read_load_data import *
```
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"https://pydicom.github.io/pydicom/stable/tutorials/dataset_basics.html\n",
"Utile pour le rapport:\n",
"http://www.dimitripianeta.fr/documents/traitements/comprendre%20les%20m%C3%A9tadonn%C3%A9es%20.pdf"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"input_directory='../osic-pulmonary-fibrosis-progression'\n",
"patient = 'ID00419637202311204720264'\n",
"image = '10.dcm'\n",
"path = f'{input_directory}/train/{patient}/{image}'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Dataset.file_meta -------------------------------\n",
"(0002, 0000) File Meta Information Group Length UL: 200\n",
"(0002, 0001) File Meta Information Version OB: b'\\x00\\x01'\n",
"(0002, 0002) Media Storage SOP Class UID UI: CT Image Storage\n",
"(0002, 0003) Media Storage SOP Instance UID UI: 2.25.15591725989708101768360543306906204110\n",
"(0002, 0010) Transfer Syntax UID UI: Explicit VR Little Endian\n",
"(0002, 0012) Implementation Class UID UI: 1.2.276.0.7230010.3.0.3.6.1\n",
"(0002, 0013) Implementation Version Name SH: 'OSIRIX_361'\n",
"(0002, 0016) Source Application Entity Title AE: 'ANONYMOUS'\n",
"-------------------------------------------------\n",
"(0008, 0005) Specific Character Set CS: 'ISO_IR 100'\n",
"(0008, 0008) Image Type CS: ['ORIGINAL', 'PRIMARY', 'AXIAL']\n",
"(0008, 0018) SOP Instance UID UI: 2.25.15591725989708101768360543306906204110\n",
"(0008, 0060) Modality CS: 'CT'\n",
"(0008, 0070) Manufacturer LO: 'PACSGEAR'\n",
"(0008, 1090) Manufacturer's Model Name LO: 'LightSpeed VCT'\n",
"(0010, 0010) Patient's Name PN: 'ID00419637202311204720264'\n",
"(0010, 0020) Patient ID LO: 'ID00419637202311204720264'\n",
"(0010, 0040) Patient's Sex CS: ''\n",
"(0012, 0063) De-identification Method LO: 'Table;'\n",
"(0018, 0015) Body Part Examined CS: 'Chest'\n",
"(0018, 0050) Slice Thickness DS: \"1.25\"\n",
"(0018, 0060) KVP DS: \"120.0\"\n",
"(0018, 1110) Distance Source to Detector DS: \"949.075012\"\n",
"(0018, 1111) Distance Source to Patient DS: \"541.0\"\n",
"(0018, 1120) Gantry/Detector Tilt DS: \"0.0\"\n",
"(0018, 1130) Table Height DS: \"197.0\"\n",
"(0018, 1140) Rotation Direction CS: 'CW'\n",
"(0018, 1151) X-Ray Tube Current IS: \"301\"\n",
"(0018, 1170) Generator Power IS: \"36000\"\n",
"(0018, 1190) Focal Spot(s) DS: \"0.7\"\n",
"(0018, 1210) Convolution Kernel SH: 'BONEPLUS'\n",
"(0018, 5100) Patient Position CS: 'FFS'\n",
"(0020, 000d) Study Instance UID UI: 2.25.24142809421030670533829469959522337181\n",
"(0020, 000e) Series Instance UID UI: 2.25.72922870310959542985933229225637751168\n",
"(0020, 0010) Study ID SH: ''\n",
"(0020, 0013) Instance Number IS: \"10\"\n",
"(0020, 0020) Patient Orientation CS: ''\n",
"(0020, 0032) Image Position (Patient) DS: [-212.600, -170.700, -54.000]\n",
"(0020, 0037) Image Orientation (Patient) DS: [1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]\n",
"(0020, 0052) Frame of Reference UID UI: 2.25.87733149435852076944786005695371983233\n",
"(0020, 1040) Position Reference Indicator LO: 'SN'\n",
"(0020, 1041) Slice Location DS: \"-54.0\"\n",
"(0028, 0002) Samples per Pixel US: 1\n",
"(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'\n",
"(0028, 0010) Rows US: 1100\n",
"(0028, 0011) Columns US: 888\n",
"(0028, 0030) Pixel Spacing DS: [0.820312, 0.820312]\n",
"(0028, 0100) Bits Allocated US: 16\n",
"(0028, 0101) Bits Stored US: 16\n",
"(0028, 0102) High Bit US: 15\n",
"(0028, 0103) Pixel Representation US: 1\n",
"(0028, 0120) Pixel Padding Value US: 63536\n",
"(0028, 1050) Window Center DS: \"-500.0\"\n",
"(0028, 1051) Window Width DS: \"-1500.0\"\n",
"(0028, 1052) Rescale Intercept DS: \"0.0\"\n",
"(0028, 1053) Rescale Slope DS: \"1.0\"\n",
"(0028, 1054) Rescale Type LO: 'HU'\n",
"(7fe0, 0010) Pixel Data OW: Array of 1953600 elements"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pydicom\n",
"\n",
"ds = pydicom.filereader.dcmread(path)\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0018, 1111) Distance Source to Patient DS: \"541.0\""
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem = ds[0x0018, 0x1111]\n",
"elem"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'DistanceSourceToPatient'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem.keyword"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"541.0\""
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"elem.value"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0018, 1111) Distance Source to Patient DS: \"541.0\""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds['DistanceSourceToPatient']"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"541.0\""
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.DistanceSourceToPatient"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},