cortex-lab / Suite2P

Tools for processing 2P recordings
Other
120 stars 65 forks source link

saving registered uint16 data #180

Open poherron opened 4 years ago

poherron commented 4 years ago

Hello. I tried to append this comment into issue #121 which addressed some aspects of the problems with uint16 data. But I guess since it is closed I'll need to open a new issue. I am also running into issues with my image data being stored as uint16. Won't dividing all your unit16 data by 2 (as suggested in comment #121 and what the ops.scaleTiff fix does) cause you to lose a lot of dynamic range in your luminance? You're cropping off the high values but the low ones aren't extending into negative values by a similar amount with this fix. Maybe I misunderstand how this works. Also, I am trying to save the registered tiffs as uint16 but I get an error that the tiff writing function can't write to uint16: Error using tifflib If SampleFormat is Int, the image datatype is restricted to one of the following: int8, int16, int32.

Error in Tiff/writeAllStrips (line 1969) tifflib('writeEncodedStrip',obj.FileID, stripNum-1,imageData(row_inds,:));

Error in Tiff/write (line 1477) obj.writeAllStrips(varargin{:});

Error in TiffWriter (line 20) t.write(image(:,:,1));

Error in write_reg_to_tiff (line 51) TiffWriter(uint16(data),fname,bitspersamp);

I'm also a little worried if the conversion to single in rigidRegFrames.m has any effect. The span of values in my aligned data (int16) differs from my original data (uint16) and the registered tiffs seem to have a higher background luminance when I open them in ImageJ than the original data. Thanks for any help.