6

I am reading multiframe dicom as follows and get total pixel data of image in byte array.

 gdcm.ImageReader _reader = new gdcm.ImageReader();
_reader.SetFileName("FileName");
_reader.Read(); 
byte[] byteArray= new byte[_reader.GetImage().GetBufferLength()];
_reader.GetImage().GetBuffer(byteArray);

but it gives out of memory exception for multiframes having more than 300 frames. So I want to extract single frames pixel data in a byte array at a time. Any idea??

Namrata
  • 173
  • 8
  • How big is this file? Maybe rather than using a bytearray try using a numpy array -- the memory management maybe be better array = np.frombuffer(_reader.GetImage().GetBuffer(), dtype = np.uint8) Are you using 32 or 64 bit Python? – g.stevo Apr 30 '17 at 21:11
  • Its 32 bit. I am not doing it in python, its winforms application. – Namrata May 02 '17 at 05:33
  • Right so it's a win32 .Net application? you'll be limited to 2Gb in RAM - I would suggest moving to 64bit unless you mean the datatype? – g.stevo May 02 '17 at 18:06
  • I used gdcm box region and region reader to read single frames byte array. But I have one doubt, please see the answer of this post – Namrata May 04 '17 at 10:40

0 Answers0