Resize the Depth of CT data in Python

198 Views Asked by At

I have multiple CT datasets in Dicom format all with varying number of slices or 2D CT images.

Example:

Dataset 1 Shape: (512 x 512) x 100

Dataset 2 Shape: (512 x 512) x 130

Dataset 3 Shape: (512 x 512) x 122

How can I resize the data such that the depth (number of slices) is the same for al datasets?

The idea being this data will be passed into a 2D CNN with input shape: [slices, 512, 512, channels 1]

Thanks for the help

1

There are 1 best solutions below

1
On

IMHO the short answer is you can't, but also you shouldn't even try.


Clinical data is like that. Even for a scan of the same anatomical region (say pelvis), each scan (depending on clinical protocol, organization's protocols, slice thickness, technician decisions, patient symptoms, ..., ...) will have a varying number of slices.


If you try to train an algorithm based on a fixed number of slices you are guaranteed to develop an algorithm that may work for your training/test data, but will absolutely fail in real clinical use.


I would suggest you google why AI algorithms fail in clinical use so often to get an understanding of how AI algorithms developed without a) broad clinical understanding, b) technical understanding of the data, c) extensive and broad training data and d) understanding of clinical workflows will almost always fail


You could, in theory, try to normalize the data's dimensions based on anatomy your looking at, but then you need to be able to correctly identify the anatomy you're looking at, which itself is a big problem. ...and even then, every patient has different dimensions and anatomical shape.


You need to train with real data, the way it is, and with huge training sets that will cover all technical, clinical and acquisition variability to ensure you don't end up with something that only works 'in the lab', but will fail completely when it hits the real world.