Again we read in the data

t1 = neurobase::readnii("training01_01_t1.nii.gz")

Density of an Image

Let’s do a marginal density of the values:

plot(density(t1)) # large spike at 0

Density with a mask

You can also pass in a mask to most standard functions:

plot(density(t1, mask = t1 > 0))

Similarly: a Histogram

Note the high intensities:

hist(t1)

Orthographic view with additions

The neurobase::ortho2 function displays nifti objects in 3 different planes.

neurobase::ortho2(t1)

Brightening up the image

We see a dark image; a this single large value affects how values are mapped. The function robust_window calculates Winsorizes an image, by default the 0 (min) and 99.9th quantile, and sets values outside of this range to that quantile (97.5th below).

ortho2(robust_window(t1, probs = c(0, 0.975)))