add similar CT but with pixel centred on image CAX along the x- and z-axes
"import shutil\n",
"from datetime import datetime\n",
"\n",
- "os.chdir(r\"E:\\Workspace\\dicomutils\\cube\")\n",
- "if not os.path.exists(\"cube_adjusted\"):\n",
- " os.mkdir(\"cube_adjusted\")\n",
+ "os.chdir(r\"E:\\Workspace\\dicomutils\\cube2\")\n",
+ "if not os.path.exists(\"cube2_adjusted\"):\n",
+ " os.mkdir(\"cube2_adjusted\")\n",
"\n",
"for file in glob.glob(\"CT*.dcm\"):\n",
" ds = dcm.dcmread(file)\n",
" ds.DerivationDescription = \"Generated using PyDICOM & RaySearch's dicomutils\"\n",
" \n",
" ds.PatientName = \"Phantom^Water\"\n",
- " ds.PatientID = \"PMP_WATER\"\n",
+ " ds.PatientID = \"WATER\"\n",
" ds.PatientSex = \"O\"\n",
- " ds.SliceThickness = 5\n",
- " ds.Rows = 500\n",
- " ds.Columns=500\n",
" \n",
- " ds.ImagePositionPatient[0]=-249.5\n",
+ " ds.ImagePositionPatient[0]=-250\n",
" ds.ImagePositionPatient[1]=0.5 \n",
" \n",
- " ds.save_as(\"cube_adjusted\\\\\" + file)\n",
+ " ds.save_as(\"cube2_adjusted\\\\\" + file)\n",
" print(ds.ImagePositionPatient)\n",
" print(ds.PixelSpacing[0])\n",
" \n",
- "shutil.make_archive(\"cube_adjusted\", 'zip', \"cube_adjusted\")"
+ "shutil.make_archive(\"cube2_adjusted\", 'zip', \"cube2_adjusted\")"
]
},
{
