Creating Multichannel Image Stacks

for ConfocalVR and ExMicroVR

(Note – An ImageJ macro to perform this sequence is given at the end of this document)

 While single channel RGB image-stacks (z-stacks) can be loaded and viewed in ConfocalVR, if you want to manipulate the RGB colors separately, or if you are using a microscopy technique that generates multiple image stacks from the same sample (e.g. expansion microscopy), use the method below to create a directory holding one 3D image for each channel you want to view and manipulate.

Use ImageJ (Fiji) to create a directory of image-stack files, one file for each channel

  • Load your raw image file from your microscope into ImageJ using the Bio-Formats macro
    • run(“Bio-Formats Importer”);
      • Do not split channels
      • Import as gray-scale images
    • If image more than 1000x1000x100 you may need to reduce image size so that it will load into your VR system’s GPU. You can Crop or Scale
      • CROP (keeps full resolution but you can only look at a section of full image)
        • Use ImageJ rectangular selection tool to select out the 1000×1000 section of the image that most interests you
        • Use Image/Crop pulldown menu to crop
        • Now all channels are cropped and aligned
      • SCALE (you can see full image, but at a lower resolution)
        • Use ImageJ/Image/Scale to resize image by either a fraction of original (0.0-1.0) or by setting the new X&Y dimensions you want (< 1000x1000x100)
        • Now all channels are scaled
  • Now split out the channels into separate image-stacks
    • ImageJ/Image/Color/Split Channels


  • Now for each channel image you want to adjust the image and save to a new folder properly named and located so you can browse to it when you are in ConfocalVR
    • For Each Channel:
      • Make sure you click on the image-stack you want to convert so that ImageJ will know what image to process
      • Adjust color balance (if needed)
        • Select ImageJ/Image/Adjust/Color Balance
        • Move the image-stack slider to a midpoint in the stack
        • Select “Auto” from the Color Balance menu
      • Convert to RGB (required)
        • If at this point your image is not grayscale –
          • Select ImageJ/Image/Lookup Tables/Grays
        • Select ImageJ/Image/Color/Make composite (this is not required in all cases)
        • Select ImageJ/Image/Type/RGB Color
      • Save as NIfTI file (required)
        • Make sure you have previously loaded ImageJ with the NIfTI plug-in
        • Select ImageJ/SaveAs/NIfTI-1 (at very end of menu, scroll to bottom)
        • Create a new directory to hold the channels, and save the file to that directory
  • You can now go into ConfocalVR and use the in-VR-space file browser to select the directory where you saved the channels. ConfocalVR will read all .nii files in the directory and render them, each file becoming a separate Channel in the Channel Panel display. When you click “Save Settings” one text file for each channel will be written to this same directory saving the settings of all sliders so that they can be automatically loaded the next time you open this directory, or when you click “Load Settings”.  If you create a text file and name it “ChannelsDescription.txt”, it will be read and displayed on the “Information Panel” in the VR space. Use this to provide channel explanation and attribution in free-text format.



 Example ImageJ Macro

for Automated Image Conversion


Save this text below with a descriptive name, such as “OMETIFF2NII.ijm”, and save it somewhere you can find later.  When you run ImageJ,  from the top menu select:  Plugins/Macros/Run, and select the .ijm file.  Note that the channel names are retrieved from the OME-TIFF file and used to name the individual NIfTI files so that when the directory is loaded, the filenames will be read and shown on the VR “Channels” display panel.

run(“Close All”);


run(“Bio-Formats Macro Extensions”);

id = File.openDialog(“Choose a file”);

print(“id = ” + id);



path = File.getDirectory(id);

print(“path = “+path);

name = File.getName(id);

print(“name = “+name);

run(“Bio-Formats Importer”, “open=[” + id + “] autoscale color_mode=Composite rois_import=[ROI manager] split_channels view=Hyperstack stack_order=XYCZT”);

for (i = 0;  i < sizeC;  i++)  {

                selectWindow(name + ” – C=” + i);

                run(“Color Balance…”);

                run(“Enhance Contrast”, “saturated=0.35”);

                run(“RGB Color”);

                channelName = getInfo(“slice.label”);

                channelNameClean = channelName.replace(“:”,”-“);

                print(“Channel name = ” + channelNameClean);

                run(“NIfTI-1”, “save=[“+ path + channelNameClean + “.nii]”);