hello,

Problem: in a 3D stack, the mean intensity varies along the z - axis according to a certain function, e.g. like a Gaussian. How can I compensate this trend for the entire stack?

hello,

Problem: in a 3D stack, the mean intensity varies along the z - axis according to a certain function, e.g. like a Gaussian. How can I compensate this trend for the entire stack?

Good day Andreas,

what about looping all slices and multiplying every slice by the inverse of the corresponding attenuation?

Regards

Herbie

**PS:**

Here is an example Macro that does this for the â€śMRI Stackâ€ť:

```
run("MRI Stack (528K)");
run("32-bit");
setSlice(1);
getRawStatistics(N, refMn);
for ( i=2; i<=nSlices; i++ ) {
setSlice(i);
getRawStatistics(N, mn);
run("Multiply...", "value="+d2s(refMn/mn,9)+" slice");
setResult("Original", nResults, d2s(mn,3));
getRawStatistics(N, mn);
setResult("Compensated", nResults-1, d2s(mn,3));
}
setSlice(1);
exit();
```

Paste the above macro code to an empty macro window (Plugins >> New >> Macro) and run it.

(You need an open internet connection to load the demo image.)

1 Like