This notebook imports SES images from a single directory and calculates the mean intensity of each image to get a relative measurement of how much sediment was between the light source and the camera. This essentially uses the SES as a transmissometer.

First get all the file names from a directory of images from Pulse 70.

fnames=FileNames["StaM_7001_SESext*","/Volumes/ProjectLibrary/901027.SedimentationEventSensor/Deployments/Deployment.Data/Pulse_70/dep-2018.04.19-05-Pulse-70/fluoro_images"];

Length[fnames]

Check that we’re getting the files we want.

fnames[[;;5]]

fnames[[-5;;]]

Look at a sample image.

fnames[[182]]

image=Import[fnames[[182]]]

Total intensity sums the intensity of each pixel in the image, so the total is a large number.

totalIntensity=ImageMeasurements[image,"TotalIntensity"]

Mean intensity calculates the average intensity over the whole image. White pixels raise the mean, black pixels lower it.

totalIntensity=ImageMeasurements[image,"MeanIntensity"]

We can map the MeanIntensity measurement function over a number of images.

(* meanInts=ImageMeasurements[Import[fnames[[#]]],"MeanIntensity"]&/@Range[41,51] *)

Measure the mean intensity for all of the external light images.

(* meanInts=ImageMeasurements[Import[#],"MeanIntensity"]&/@fnames; *)

Save the data in a file so we don’t have to calculate them again. Use Get[filename] to retrieve the values from the file.

(* Save["P70meanInts.dat",meanInts]; *)

meanInts=Get["P70meanInts.dat"];

ListPlot[meanInts,PlotRange->All]

We want to use the brightest image to establish our scale at 100%.

maxImg=First@First@Position[meanInts,Max@meanInts]

image=Import[fnames[[maxImg]]]

scale=Max[meanInts]

Scale all the brightnesses from 1 being the darkest to 0 being the brightest. This is now a proxy for the quantity of sediment on the sample slide.

scaledMeanInts=1-(meanInts/scale);

Max[scaledMeanInts]

ListPlot[scaledMeanInts,PlotRange->All]

ListPlot[scaledMeanInts 100,{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},FrameLabel->{{"Light Attenuation (%)",""},{"Sample Number","Pulse 70 SES Sediment Quantity"}}}]

laplot=DateListPlot[scaledMeanInts 100,{{2018,4,19,22,29,6},{2018,10,17,12,36,23}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Year 2018)","Pulse 70 SES Sediment Quantity"}}}]

laplot=DateListPlot[LowpassFilter[scaledMeanInts 100,0.1],{{2018,4,19,22,29,6},{2018,10,17,12,36,23}},{PlotRange->{All,{0,100}},Frame->True,Joined->True,BaseStyle->{FontWeight->"Normal",FontSize->14},GridLines->{Automatic,None},FrameLabel->{{"Light Attenuation (%)",""},{"Time (Year 2018)","Pulse 70 SES Sediment Quantity\rLow-pass Filtered"}}}]