I'm using "-4 -D -T" to transform a 14 bit raw image (.nef) to a linear unprocessed tiff image. Is it the correct command? Does the command differ for 12 bit or 16 bit image?
I have written a bad answer and deleted it, here is another attempt.
-4 -D -T preserves RAW numbers and writes them to 16 bit file while using only one fourth of values for 14 bit images and only one sixteenth of values for 12 bit images. You will never see white if you use
-D, only gray.
It is intended to be used this way, it is not incorrect for any bit depth.
BUT: if you want DcRaw to use all available bit depth in output file, you may try replacing
-4 -D -T with
-d -T -6 -W -g 1 1 -r 4 4 4 4 for 14 bit input or with
-d -T -6 -W -g 1 1 -r 16 16 16 16 for 12 bit input.
This gives normal brightness (if you use gamma 1 profile), I tried it.
ADDED: there are two things which should be dealt with: black level and NEF lossy compression (if it is selected). If you use -D, you will at least cancel black level and possibly gamma-correction too. If you use -d, you may exprect better results.
More about this in this paper.
dcraw -o 0 -D -T -4
This preserves the 12- or 14-bit integer pixel values exactly as they were recorded in the raw file, without any processing or rescaling. (Thanks to Patrick Hurley)
I saw it in your other questions that ultimately you import the data to Mathematica. In Mathematica you can import a raw file directly as
Here's the documentation page: http://reference.wolfram.com/language/ref/format/Raw.html The feature requires Mathematica 10.1 or later.