title: DICOM to TIFF inverted LUT ... Python & PIL
body: <p>I am using the <strong>frombuffer</strong> command to save DICOM image data as TIFF images. But somehwere throughout this process, the image intensities are inverted (inverted LUT). Any idea on how to overcome this?</p>
  
  <p>I have tried using the <strong>ImageOps.invert</strong> function from PIL, but if gives me "not supported for this image mode" error.</p>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>import dicom
  import Image
  import PIL.ImageOps
  
  meta=dicom.read_file("DicomImage.dcm") 
  imHeight=meta.Rows
  imWidth=meta.Columns 
  imSize=(imWidth,imHeight)
  TT=Image.frombuffer("L",imSize,meta.PixelData,"raw","L",0,1)
  TT.save("testOUTPUT.tiff","TIFF",compression="none")
  </code></pre>
  
  <p>Any guidance is appreciated ...
  Python 2.7
  PIL 1.1.7
  Pydicom 0.9.6</p>