# How to apply color function (e.g. Hue) to Image3D?

I have a 3d image data PlotData1, and I want to plot the Image3D with color. I tried this (Note: I don't have Plot1 in my actual case. I only have PlotData1):-

Plot1 = Import["ExampleData/CTengine.tiff", "Image3D"];
PlotData1 = ImageData@Plot1;
PlotData1Filtered = PlotData1 /. x_ /; x < 0.2 -> 0;
PlotData1Normlalized = PlotData1Filtered/Max[Flatten@PlotData1Filtered];
Image3D[PlotData1Normlalized, ColorFunction -> "Hue"]


But I just have the grayscale 3D without color. But I need color based on the different intensity of the pixels (i.e. voxels).

I also tried Image3D[PlotData1Normlalized, ColorFunction -> Function[{x, y, z, intensity}, Hue[intensity]]], but it doesn't work. What can I do?

Thanks!

The intensity is the first argument given to the color function, so you got the arguments wrong. We also need to make the background transparent. Here is an example:

Image3D[PlotData1Normlalized, ColorFunction -> (If[
# == 0,
Transparent,
Hue[#, 1, 1, 0.1]
] &)]


The 0.1 is the opacity. If you don't want to use opacity, you can simply use Hue[#].