If you want to batch process, the only solution I know is to process your raw files first to split them into R, B, and B fits files. You would then load the fits files as three separate stacks in AstroImageJ.
The best tool I've seen for doing this with Canon files is the Python routine "cr2fits.py". It is available here:
It depends only on widely available Python libraries, and will produce a fits file in a selected filter. You would have to set it up in a repetitive script to do this for all files in a directory, and for each of the R,G, and B bands you wanted to extract. However, it would be hands-off once started.
If you have only a few files and want to interact with them, then you can use the ij-dcraw plugin or dcraw itself to produce a 16--bit tiff color image from the raw file. The plug-in is here:
You copy it into the plugins directory of your AstroImageJ installation. It also needs a dcraw binary specific to your operating system that must be in plugins/dcraw . In Linux, if you have dcraw already just make this directory under plugins and then cd dcraw, "ln -s /usr/bin/dcraw dcraw" so that AstroImageJ will find it. (Or put another copy of it there).
when you open the plugin it will prompt for a file, offer some options, and then convert and load the 3 filters as separate images in a color stack. You would have to separate them from the stack, and reorganize to do the photometry on a new stack for each filter. I do not know how to automate this process, but probably with an IJ macro you could do the whole task inside AstroImageJ.
I tried both approaches with some sample RAW Canon (non-astronomical) images from the web and this seems to give the results needed to do photometry on DSLR color images. I don't have any astronomical Canon images to try though.
If you have dcraw itself, you can read the raw file and convert it to a 16-bit linear tiff, which can then be loaded directly into AstroImageJ. The appropriate dcraw command is
dcraw -4 -T file
and the output will be a file with a tiff extension. You can then load that tiff image into AstroImageJ and it will appear as a 16-bit color stack.
With the "-4 -T" command line option, dcraw will make a linear image file without trying to make the corrections that may be in the raw file header. dcraw will process in batch, and you can use a wildcard for the "file" to have all of them done at once and returned as separate tiff files.
This does not seem to be particularly useful for AIJ because when you load a stack of 16-bit color tiffs they separate sequentially in the same stack -- image1-R, image2-G, image1-B, image2-R and so on.
It seems if you have many files, the simplest approach would be to do the separation into fits files for each color first and then load those into AIJ for processing.
I have a similar problem. I converted my Canon raw images with 'rawtran' (http://integral.physics.muni.cz/rawtran/). The output is a 16 bits fits format with a slice (stack) for each channel (RGB). rawtran uses dcraw for its conversion.
I noticed that the result differs per computer. On my computer at home (linux mint) I did exactly the same conversion as at my work (ubuntu linux) with both the same tools (rawtran and dcraw). When I load the fits image in ImageJ and measure the image, the results differ slightly even though the original CR2 file is exactly the same.
The images I used were flat-fields made with my camera.
Here the results from my home computer:
Label Mean StdDev Min Max
IMG_0187.fits:1 33105,518 1441,352 13574 65535
IMG_0188.fits:1 32777,633 1441,279 13295 65535
Here the result from my work computer:
Label Mean StdDev Min Max
IMG_0187.fits:1 33094.344 1442.181 13554 65535
IMG_0188.fits:1 32781.888 1439.457 13294 65535
I did the conversion as follows:
rawtran -o IMG_0187.fits IMG_0187.CR2
rawtran -o IMG_0188.fits IMG_0188.CR2
I opened the fits images in ImageJ and pressed CTRL+M (Measure).
Does anyone know how it is possible that the output differs per computer?
Does converting with other tools also cause these differences in the results?
This message is from user JohnK. Hopefully it is helpful. I don't have any direct experience with raw image processing myself:
I have used dcraw to do the conversion from native camera "raw" format to PNG before running AIJ. The dcraw code is reverse engineered from Canon images (and other manufacturers) and the program has several options when it is run that may affect the output. I don't know about rawtran. There are IJ plugins that use the dcraw software too.
When I ran into a similar need recently, I found CR2FITS, a Python program that works with raw color images (presumably what they have since it's Canon format) and extracts the red, green and blue channels as FITS files. It would be my choice for the task now.
It gives each color channel its own file before the IJ engine is involved. Of course since it's color with a Bayer mask, the full resolution representation at each pixel in each of R, G, and B is interpolated from the mask data in the raw image. cr2fits has the very nice feature of preserving the metadata in the fits header. An example from a Sony raw image is this header:
SIMPLE = True
BITPIX = 16
NAXIS = 2
NAXIS1 = 4256
NAXIS2 = 2848
EXTEND = True
BSCALE = 1
BZERO = 32768
OBSTIME = 2015-10-18 10:57:11
EXPTIME = 1/800.0
APERTUR = 22.0
ISO = 6400
FOCAL = 55.0
ORIGIN = DSC01145.ARW
FILTER = Green
CAMERA = Sony ILCE-7S
COMMENT = FITS File Created with cr2fits.py available at http://github.com/eaydin/ COMMENT = cr2fits
COMMENT = cr2fits.py version 1.0.3
COMMENT = EXPTIME is in seconds.
COMMENT = APERTUR is the ratio as in f/APERTUR
COMMENT = FOCAL is in mm