Numpyarray data stored in .pkl format file. How to get image from this Numpyarray stored in .pkl format?

I have data stored in the NumPy array in .pkl file format. I only had an idea that data consists of low-dose CT DICOM images. But as the data is in array format I don’t know what the original images look like. I am stuck at this point may be my question is also not valid but still, does anybody have knowledge about it. I don’t know whether my question is valid but I I am confused here and I want to get images from it

This is the .pkl format file lowDose_CT.pkl and when I read this file I got the following output

output

[[array([[[-1000, -1000, -1000, …, -1000, -1000, -1000], [-1000, -1000, -1000, …, -1000, -1000, -1000], [-1000, -1000, -1000, …, -1000, -1000, -1000], …, [-1000, -1000, -1000, …, -1000, -1000, -1000], [-1000, -1000, -1000, …, -1000, -1000, -1000], [-1000, -1000, -1000, …, -1000, -1000, -1000]],…

abc

The numpy array should be storing the actual values (probably radiodensity in HU).
You should be able to use a medical viewer to visualize the data using a specific window.
I’m not sure how this issue is related to PyTorch, so don’t know where you are stuck.

So, does it means these NumPy arrays(array values) in .pkl format files can be visualized using a medical viewer and I can view images? Because I only have these.pkl files stored in NumPy array and I want to implement preprocessing techniques like cropping/padding/extract patches and used them for 3D CNN models for training purposes for classification task

I don’t know how medical image viewers would handle the missing voxel spacing etc., but would guess default values would be used. A simple approach would be to grab a single slice and visualize it with matplotlib.

These preprocessing steps should directly work on the numpy array or tensor and wouldn’t need a special viewer.

Same here: you should be able to directly use the array by transforming it into a PyTorch tensor and by passing it to a model.

Thank you dear i understand :slight_smile: