Function version of :py:class:`monai.transforms.croppad.batch.PadListDataCollate`. Same as MONAI's ``list_data_collate``, except any tensors are centrally padded to match the shape of the biggest tensor in each dimension. This transform is useful if some of the applied transforms gener
(batch: Sequence, method: str = Method.SYMMETRIC, mode: str = NumpyPadMode.CONSTANT, **kwargs)
| 642 | |
| 643 | |
| 644 | def pad_list_data_collate(batch: Sequence, method: str = Method.SYMMETRIC, mode: str = NumpyPadMode.CONSTANT, **kwargs): |
| 645 | """ |
| 646 | Function version of :py:class:`monai.transforms.croppad.batch.PadListDataCollate`. |
| 647 | |
| 648 | Same as MONAI's ``list_data_collate``, except any tensors are centrally padded to match the shape of the biggest |
| 649 | tensor in each dimension. This transform is useful if some of the applied transforms generate batch data of |
| 650 | different sizes. |
| 651 | |
| 652 | This can be used on both list and dictionary data. |
| 653 | Note that in the case of the dictionary data, this decollate function may add the transform information of |
| 654 | `PadListDataCollate` to the list of invertible transforms if input batch have different spatial shape, so need to |
| 655 | call static method: `monai.transforms.croppad.batch.PadListDataCollate.inverse` before inverting other transforms. |
| 656 | |
| 657 | Args: |
| 658 | batch: batch of data to pad-collate |
| 659 | method: padding method (see :py:class:`monai.transforms.SpatialPad`) |
| 660 | mode: padding mode (see :py:class:`monai.transforms.SpatialPad`) |
| 661 | kwargs: other arguments for the `np.pad` or `torch.pad` function. |
| 662 | note that `np.pad` treats channel dimension as the first dimension. |
| 663 | |
| 664 | """ |
| 665 | from monai.transforms.croppad.batch import PadListDataCollate # needs to be here to avoid circular import |
| 666 | |
| 667 | return PadListDataCollate(method=method, mode=mode, **kwargs)(batch) |
| 668 | |
| 669 | |
| 670 | def no_collation(x): |
searching dependent graphs…