[DLMED] add more description for transforms in spleen tutorial
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Setup transforms for training and validation"
+ "## Setup transforms for training and validation\n",
+ "Here we use several transforms to enhance and normalize the dataset:\n",
+ "1. `LoadNiftid` loads the spleen CT images and labels from NIfTI format files.\n",
+ "2. `AddChanneld` as the original data doesn't have channel dim, add 1 dim to construct \"channel first\" shape.\n",
+ "3. `Spacingd` adjusts the spacing by `pixdim=(1.5, 1.5, 2.)` based on the affine matrix.\n",
+ "4. `Orientationd` unifies the data orientation based on the affine matrix.\n",
+ "5. `ScaleIntensityRanged` extracts intensity range [-57, 164] and scales to [0, 1].\n",
+ "6. `CropForegroundd` removes all zero borders to focus on the valid body area of the images and labels.\n",
+ "7. `RandCropByPosNegLabeld` randomly crop patch samples from big image based on pos / neg ratio. \n",
+ " This transform can obviously enhance the dataset. The image centers of negative samples must be in valid body area.\n",
+ "8. `RandAffined` efficiently performs `rotate`, `scale`, `shear`, `translate`, etc. together based on PyTorch affine transform.\n",
+ "9. `ToTensord` converts the numpy array to PyTorch Tensor for further steps."
]
},
{
" Orientationd(keys=['image', 'label'], axcodes='RAS'),\n",
" ScaleIntensityRanged(keys=['image'], a_min=-57, a_max=164, b_min=0.0, b_max=1.0, clip=True),\n",
" CropForegroundd(keys=['image', 'label'], source_key='image'),\n",
- " # randomly crop out patch samples from big image based on pos / neg ratio\n",
- " # the image centers of negative samples must be in valid image area\n",
" RandCropByPosNegLabeld(keys=['image', 'label'], label_key='label', spatial_size=(96, 96, 96), pos=1,\n",
" neg=1, num_samples=4, image_key='image', image_threshold=0),\n",
" # user can also add other random transforms\n",
