Part 8 Software Control
Tucsen · Uploaded · 22:47 · Watch on YouTube
Tucsen's Part 8 of its Mastering Scientific Cameras course walks through the four main categories of software used to control a camera, from manufacturer packages to custom SDK builds. It also covers how file formats such as TIFF, PNG and JPG preserve or lose image data, and gives a checklist of camera controls to set for each imaging session.
Transcript
Captions as a .vtt fileEmbed with the transcript
- 0:00Welcome back to the Tucsen Mastering Scientific Cameras course.
- 0:06This is part eight, software control.
- 0:09And in this part, we're going to be taking a bit of a step back from this process
- 0:12and thinking about what software we are using to control the camera at essentially every stage.
- 0:18The software, depending on what it is and what we're doing,
- 0:21might also be controlling analysis workflows or even other hardware within our optical setup as well.
- 0:27We'll also be looking at some of the essential camera controls,
- 0:31a bit of a checklist of essential camera controls to make sure that we've optimised each time we're imaging.
- 0:38These are the controls that you always want to make sure they have values that are appropriate for what you're doing each time you image.
- 0:46So first off, we're going to have a look at some of the different control software options,
- 0:51which are available to control cameras.
- 0:53Broadly speaking, we can divide these into four categories.
- 0:58First off, we have camera control software made by camera manufacturers.
- 1:03This might be the simplest and easiest way to get set up and get imaging,
- 1:09but typically this won't offer things like control over multiple other pieces of hardware
- 1:14or really advanced analysis and this kind of thing.
- 1:18But what it will offer is all of the controls of the camera,
- 1:23easily accessible and user-friendly,
- 1:26with perhaps some basic image enhancements, analysis or measurement tools thrown in there.
- 1:32A good example of this is Mosaic from Tucsen,
- 1:36which in fact is a little bit more powerful than these softwares tends to be.
- 1:39It's a very nice piece of software, both easy to use and powerful.
- 1:43Next, we have more general-use custom programmable software, such as LabVIEW and MATLAB.
- 1:52And in these cases, these softwares allow you to design your own experimental workflows,
- 1:58both on the acquisition side and on the analysis side,
- 2:02and then cameras can be integrated into those workflows.
- 2:05Next, we have microscopy-specific software, such as Micromanager, which is free and open source,
- 2:14or Metamorph, or software from microscope companies themselves.
- 2:19And in this case, these softwares tend to be able to control all the different automatable hardware
- 2:25that microscopes can offer.
- 2:27And this will make things much simpler and easier if you are running a microscope,
- 2:35because they'll have microscopy-specific workflows, analysis routines, experimental design tools,
- 2:41and all of this kind of thing.
- 2:45And then finally, for the truly custom option, we have integration into your own software,
- 2:51whether that's an existing piece of software or a new software that you're designing around an application.
- 2:57The software development kit, SDK, allows programmatical access to the camera
- 3:04in various languages, including C, C++, and C-sharp.
- 3:13Starting off with camera control software from the camera manufacturer,
- 3:18this will typically be free with the camera, offering basic camera control and capture.
- 3:24Some image enhancement tools and some analysis tools might be built in.
- 3:28But Mosaic is a really good example of this.
- 3:33It's got a really nice, simple, intuitive GUI.
- 3:37You can review captured images and make alterations,
- 3:41like brightness, contrast, and tinting images that were acquired in black and white.
- 3:45But in fact, we want them to have a specific color,
- 3:49representing, for example, the wavelength that we acquired them with.
- 3:52And we have some powerful analysis and acquisition tools built in,
- 3:57including multi-channel acquisition, tint and merge,
- 4:01for building up multi-channel images with monochrome cameras.
- 4:07And also, these quite advanced tools, such as an auto-counting algorithm,
- 4:13real-time image stitching, which is really powerful.
- 4:16If you move your large sample around with your stage on a microscope,
- 4:21the camera can be running in real-time,
- 4:24automatically stitching together a large-scale image
- 4:27to represent fields of view massively larger
- 4:30than what the camera can represent in one single image.
- 4:33This is a very powerful tool.
- 4:35And finally, we have a similar real-time tool
- 4:39for doing this same process, but with depth of field,
- 4:43where our focal plane will only represent a certain area
- 4:50of a three-dimensional sample.
- 4:53Only a certain area will be in focus.
- 4:56But we can sweep up and down a three-dimensional sample
- 5:00and build up an enhanced depth-of-field image
- 5:04simply by moving up and down through our sample.
- 5:08And the software will stitch that together in real-time.
- 5:13For general-use programmable software,
- 5:16such as National Instruments LabVIEW and MathWorks MATLAB,
- 5:21these can be hugely versatile pieces of software.
- 5:24LabVIEW, if you're familiar, has this more graphical interface
- 5:28and MATLAB is more programming-based.
- 5:31But in both cases, they're really good
- 5:33if you need to control lots of hardware
- 5:35or drive optical bench equipment like Piezo's
- 5:38and similar things, maybe driving lasers.
- 5:44And camera acquisition can be directly integrated then
- 5:47into analysis pipelines as well.
- 5:49So you can have one click to run an entire experiment
- 5:52versus having to acquire data in a separate program
- 5:56and then import it.
- 5:57We can still do that, of course,
- 5:59but we also have the option to directly integrate
- 6:02our camera with our analysis.
- 6:04We can also have complete flexibility
- 6:07to design our own algorithms
- 6:09and perform our own mathematical operations
- 6:12that we need to perform
- 6:13to analyze the images that we've captured.
- 6:21Next, we have microscope control software.
- 6:24And this really allows us to get the most out of the microscope
- 6:27and the common microscopy hardware that we might be using.
- 6:30Again, we have these three examples here,
- 6:34but there are multiple microscope control softwares on the market
- 6:38from different microscope companies.
- 6:42And in general, we can control automated microscope components
- 6:48with these softwares and integrate that into our camera acquisition.
- 6:52So for example, if we want to drive a Z stage to move up and down
- 6:57through a sample in an automated way,
- 6:59this microscope control software can manage that automatically
- 7:03to move up, acquire an image, move up, acquire an image, etc.
- 7:09It tends to be powerful and user-friendly software
- 7:12for anyone from casual users to experts
- 7:15with features that can be suited
- 7:18to a number of different common applications in microscopy.
- 7:22We can really unlock the true potential of microscope equipment
- 7:28by using it with software that's designed for it.
- 7:36We have general use microscopy software from free packages
- 7:39to paid packages, and we also have software
- 7:43from microscope manufacturers.
- 7:49And finally, we have the custom software with the SDK.
- 7:53Essentially, tux and cameras don't have to be just used
- 7:57with off-the-shelf software.
- 7:58You can also write your own software using the SDK,
- 8:02the software development kit, to integrate that software
- 8:06and interface that software with the cameras.
- 8:11Most cameras allow operation via C, C++ or C sharp commands.
- 8:17And this allows you to access only the functions
- 8:21and controls of the camera that you need to make software
- 8:23that's simpler and more efficiently designed
- 8:26for your particular application and your particular workflows.
- 8:31If you're using cameras as an OEM
- 8:33and you're trying to design software
- 8:35that will give your customers the most powerful
- 8:38and efficient experience, then the SDK allows you
- 8:41to have complete control over this process
- 8:44and really maximize the chances
- 8:46that everything is successfully deployed.
- 8:50Finally, we're going to have a look
- 8:51at the different file types available to us
- 8:53as users of camera software.
- 8:55For scientific images, as opposed to just the images
- 8:59that might come from our iPhone or our consumer camera,
- 9:02we have different file types available to us
- 9:05because the data is subtly different.
- 9:08We have to consider some different factors
- 9:11in choosing a file type.
- 9:13One important one is data preservation.
- 9:16And the question here is,
- 9:18if we have a 12-bit camera, for example,
- 9:20is that entire bit depth preserved
- 9:23when we save that image
- 9:24or is it compressed down to 8-bits
- 9:27as all images acquired on consumer cameras tend to be?
- 9:32If it's compressed down,
- 9:37the next question is flexibility.
- 9:40What other software can work with that file type?
- 9:42And is the metadata,
- 9:44that's the information about any other hardware
- 9:47that was being controlled by the software at the time,
- 9:49the timestamp of the image,
- 9:52any information about the scale bars
- 9:54and similar things in the image,
- 9:56information about the lenses with which it was acquired,
- 9:59if that's available,
- 10:00all of that data about the data,
- 10:02the metadata,
- 10:03is that included when you save the image
- 10:06is another question that we need to ask.
- 10:07Also, the file size can sometimes be important.
- 10:13If you're acquiring a massive quantity of images,
- 10:16then we might be significantly weighed down
- 10:20by large file sizes.
- 10:22So the question is then,
- 10:24does this file type offer compression of the information?
- 10:28But importantly, we need to realise
- 10:30whether this compression is lossless or lossy,
- 10:35i.e. does the act of compressing the data
- 10:38lose some of the data?
- 10:40Whether that's perceptible or not,
- 10:42are the true intensity values still preserved?
- 10:46So we're going to look at a few file types
- 10:48and we can generally rank them
- 10:50between the best data preservation
- 10:52and the smallest file size.
- 10:56So we have .tiff files, .png and .jpg
- 11:00are the three most common options
- 11:02that are available to us.
- 11:05And if we look at .tiff files,
- 11:07this is kind of the scientific standard
- 11:09because the original raw image data is preserved.
- 11:13The full 16-bit depth of 16-bit images
- 11:19will be preserved.
- 11:2112-bit will be preserved, et cetera.
- 11:24The actual values that our camera has given us,
- 11:28which will be, of course,
- 11:29the ones that we would want to use
- 11:30in analysis pipelines,
- 11:32those are preserved.
- 11:33Images are completely uncompressed,
- 11:36so there's no form of compression
- 11:38that other software would have to decompress effectively.
- 11:44But this preservation of the original image data
- 11:49means that our standard 16-bit scientific tiffs
- 11:53can't be opened correctly
- 11:55in most non-scientific software.
- 11:57And that's because, if we recall,
- 11:59we're applying histogram scaling settings
- 12:01to our data with scientific software.
- 12:05We don't have, typically,
- 12:08image data all the way up to an intensity value of 65,000,
- 12:13you know, representing fully white
- 12:15if we see the whole scale.
- 12:17But non-scientific software doesn't realize that.
- 12:20It just attempts to show the entire scale
- 12:22from zero all the way up to 65,536.
- 12:27And if most of our image intensity values
- 12:30are, say, less than 1,000,
- 12:32then it's going to be a very, very dark image.
- 12:34And that's how a lot of images will appear.
- 12:38So, for example, if we save .TIFF files
- 12:40and then just look at a thumbnail of that image
- 12:44in Windows Explorer
- 12:45or try and open that image in, you know,
- 12:47simple software like Windows Image Viewer,
- 12:52then it's going to look mostly black
- 12:54or very gray in most cases.
- 12:57So that's just something to bear in mind,
- 12:58that we need scientific software
- 13:00to work with scientific tiffs.
- 13:03But finally, unfortunately, for TIFF files,
- 13:06almost all the time,
- 13:07the metadata around the image is also included.
- 13:13Next up, we have .png files.
- 13:15And this is the first of our two compressed file formats.
- 13:20But with .png and .jpg,
- 13:22the thing to realize is that images are rescaled
- 13:25to 8-bit according to the current
- 13:28histogram scaling settings.
- 13:30So as we have these histogram settings
- 13:33that rescale our, you know,
- 13:35higher bit depth information
- 13:36to the 8-bits that our monitors can work
- 13:39with, when we save that image
- 13:41to .png or .jpg,
- 13:43that rescaling to 8-bit is saved
- 13:47and preserved and applied to the images.
- 13:50And the original values are lost.
- 13:53So that's something to bear in mind
- 13:55that if we save as .png or .jpg,
- 13:58we are not preserving
- 13:59that original image intensity values.
- 14:01But for .png,
- 14:02but for .png,
- 14:04a lossless compression
- 14:07is applied to the actual image
- 14:10after this rescaling,
- 14:13meaning no information is lost
- 14:14about these rescaled values.
- 14:17Of course, the original intensity values
- 14:19are lost,
- 14:20but there's no change made
- 14:22after this rescaling
- 14:23when the files are compressed.
- 14:27.png files are completely versatile
- 14:29in using them in other software
- 14:31like Microsoft Word
- 14:32or whatever it would be.
- 14:34And they do have
- 14:35a significantly smaller file size
- 14:37typically than .tiff files.
- 14:40Finally, we have what's typically
- 14:42the smallest file size
- 14:43available to us,
- 14:44which is .jpg files.
- 14:46As I mentioned,
- 14:47these are also rescaled to 8-bit,
- 14:50applying the histogram scaling settings
- 14:52just like .png.
- 14:53But in this case,
- 14:55.jpg uses a lossy compression,
- 14:58meaning that the actual image
- 14:59that we see
- 15:00is going to be distorted
- 15:02in some way,
- 15:04whether that's a large-scale distortion
- 15:07that we'll see
- 15:08or whether it's completely imperceptible
- 15:10is down to different images
- 15:13and different levels of compression
- 15:15that different software might use
- 15:16in storing .jpg files.
- 15:19But there's some chance
- 15:20that image details
- 15:21might be lost or distorted
- 15:22by this compression process.
- 15:25And that's something
- 15:26to always remember
- 15:27if we're using .jpg files
- 15:29in a scientific context.
- 15:31If we're just saving them
- 15:32to look at them by eye
- 15:36for maybe more qualitative
- 15:37measurements and evaluations,
- 15:40then it's very likely
- 15:42that these compression artifacts
- 15:46or potential compression artifacts
- 15:47won't really influence things.
- 15:50we'll really have to zoom in
- 15:52very close to the image
- 15:54and sort of examine it
- 15:55on a pixel level typically
- 15:56to really see compression artifacts
- 15:59with .jpg.
- 16:00But it might change
- 16:01from application to application.
- 16:03So this is something
- 16:03that would be wise to explore.
- 16:06But just like .png,
- 16:07these can of course
- 16:08be opened in all software
- 16:09and .jpg offers
- 16:11the smallest file size
- 16:12typically of these three.
- 16:17So we're going to round off
- 16:19with an essential camera controls checklist.
- 16:23So these are the things
- 16:24to bear in mind
- 16:25each time you image
- 16:26whatever software package
- 16:28you're using
- 16:29we would typically want
- 16:30to make sure
- 16:31that all of these camera controls
- 16:34are set to values
- 16:35that make sense
- 16:36for our imaging application.
- 16:41So first of all
- 16:41we have histogram controls
- 16:43and we've talked about these before.
- 16:46If these aren't set appropriately
- 16:48you might not see
- 16:49what you expect to see
- 16:50might start changing
- 16:52other settings
- 16:53to correct a problem
- 16:55that's actually
- 16:56in our histogram controls.
- 16:58We also sometimes
- 17:00have different readout modes
- 17:01for some cameras
- 17:04which might offer
- 17:05different speed,
- 17:06dynamic range
- 17:07or noise characteristics
- 17:08and behaviors.
- 17:10For some cameras
- 17:11we will have
- 17:12selectable gain settings.
- 17:15We talked about gain before
- 17:16and how appropriate
- 17:17how important it is
- 17:18to set this correctly.
- 17:20For low light imaging
- 17:21usually the maximum gain setting
- 17:24a value
- 17:25the maximum gain setting
- 17:27available
- 17:28will be the appropriate setting
- 17:30but this will change
- 17:31from camera to camera
- 17:32and it's important
- 17:33to understand
- 17:34how your camera operates.
- 17:36But if for example
- 17:38a camera offers
- 17:39you know
- 17:40two or three gain settings
- 17:41rather than
- 17:42a smoothly adjustable
- 17:45gain slider
- 17:46for these
- 17:48two or three gain settings
- 17:49cameras
- 17:50typically
- 17:51if you're working
- 17:52in low light conditions
- 17:53the highest gain setting
- 17:54is going to be the best.
- 17:56It's usually going to be
- 17:56the lowest noise
- 17:57and offer you
- 17:59the most dynamic range
- 18:00for low light imaging situations.
- 18:03For other situations
- 18:05this question of dynamic range
- 18:07is what should drive
- 18:08your decision.
- 18:09if you are having
- 18:11overexposed pixels
- 18:13in a gain setting
- 18:14then move to a lower
- 18:16gain setting
- 18:17and that's essentially
- 18:19what drives this.
- 18:21It's using the maximum
- 18:22gain setting
- 18:22that we can
- 18:23while not getting
- 18:24overexposed pixels.
- 18:28Next we have binning
- 18:29which if you recall
- 18:30is this grouping
- 18:32of pixels together
- 18:33into two by two
- 18:35or sometimes
- 18:35other groupings
- 18:36of like three by three
- 18:37or four by four
- 18:38to make effectively
- 18:40larger pixels
- 18:42in exchange
- 18:43for some slight
- 18:44noise penalty
- 18:45but this can increase
- 18:47sensitivity
- 18:48in exchange
- 18:49for reducing resolution
- 18:51but also reducing
- 18:52file size.
- 18:56Next we have
- 18:57the exposure time
- 18:58which is
- 18:59you know
- 18:59a very important thing
- 19:01to set
- 19:01for many applications.
- 19:03For some applications
- 19:04though
- 19:04it's not all that important
- 19:06to set this yourself
- 19:07and you can safely use
- 19:08auto exposure features.
- 19:10when this might be the case
- 19:11is if you have free control
- 19:13over the illumination intensity
- 19:15like in brightfield
- 19:16or phase contrast imaging
- 19:18or in inspection imaging
- 19:20it can be absolutely fine
- 19:22to let the camera decide
- 19:23what an appropriate exposure level is
- 19:26and just use
- 19:26auto exposure options.
- 19:28But if you're doing
- 19:29low light imaging
- 19:30auto exposure is unlikely
- 19:32to be the sensible choice
- 19:36because typically
- 19:38auto exposure means
- 19:39the camera will try
- 19:40to fill its entire
- 19:41full well capacity
- 19:42and if you're in
- 19:44a low light situation
- 19:45that might mean
- 19:46a very long exposure time.
- 19:48It might mean
- 19:49for example
- 19:49if a camera has
- 19:51a very high
- 19:51full well capacity
- 19:52which many cameras do
- 19:54even if they're designed
- 19:55for low light imaging
- 19:55it could mean
- 19:56an exposure time
- 19:57of five seconds
- 19:58when an exposure time
- 20:00of 200 milliseconds
- 20:01would give you
- 20:02an image good enough
- 20:03for you to work with.
- 20:04So this is something
- 20:05to be aware of
- 20:06But in general
- 20:08exposure time
- 20:09should be set
- 20:09as high
- 20:10as is practical
- 20:11for you
- 20:12until you reach
- 20:13your desired signal
- 20:14to noise ratio.
- 20:15But the order
- 20:17of this list
- 20:17is important.
- 20:18It's important
- 20:19to make sure
- 20:20that you've set
- 20:20the correct readout mode
- 20:22and gain setting
- 20:23and indeed binning
- 20:25level
- 20:26if you're using binning
- 20:27before you set
- 20:28the exposure time
- 20:29because these controls
- 20:30might change
- 20:31what the kind
- 20:32of different
- 20:34light levels
- 20:35and different
- 20:35signal to noise
- 20:36ratios you get
- 20:37at different
- 20:37exposure times
- 20:38will be.
- 20:39So set the exposure
- 20:40time after these
- 20:41other controls.
- 20:44Finally we have
- 20:45region of interest
- 20:46which is as we
- 20:48introduced before
- 20:49in the speed section
- 20:50delineating a certain
- 20:52area of our sensor
- 20:53that we want to read off
- 20:54maybe to increase
- 20:56the speed
- 20:57with which we can
- 20:58acquire images
- 21:00or simply to reduce
- 21:02file sizes
- 21:02and make things
- 21:03more streamlined
- 21:04and triggering settings
- 21:06for hardware triggering
- 21:08which we're going to
- 21:09talk about
- 21:09in the next part
- 21:10of this course.
- 21:14So in summary
- 21:15for software controls
- 21:17we have
- 21:18different software options
- 21:20for different applications
- 21:22depending on your need
- 21:23for simplicity
- 21:24programmable control
- 21:26and application
- 21:27specific features
- 21:28such as the
- 21:29microscopy tools
- 21:30that microscopy
- 21:31software offers
- 21:32and of course
- 21:33low cost might play
- 21:34into this too.
- 21:36We looked at Mosaic
- 21:37which is Tucsen's
- 21:39powerful and versatile
- 21:40free camera control
- 21:41software
- 21:42and also we have
- 21:44the SDK
- 21:45which allows integration
- 21:46into custom designed
- 21:48software.
- 21:49For the essential
- 21:51camera controls
- 21:51we had this list
- 21:54of controls
- 21:54which we can return
- 21:55to that slide
- 21:56to and work through
- 21:58the checklist
- 21:58whenever we need
- 21:59to return to it
- 22:00but just to help
- 22:02jog your memory
- 22:03next time
- 22:03we had the
- 22:04histogram controls
- 22:05the readout modes
- 22:06if the camera has
- 22:07different readout modes
- 22:08the gain setting
- 22:10if the camera has
- 22:11different gain settings
- 22:12binning controls
- 22:13exposure time
- 22:15region of interest
- 22:16and triggering settings.
- 22:18and we also looked
- 22:20at different file types
- 22:22and this is a balance
- 22:23of the smallest file size
- 22:25which is .jpeg
- 22:26typically
- 22:27versus having
- 22:28lossless compression
- 22:30.png
- 22:31or the saving
- 22:32of the true
- 22:33original raw
- 22:34image data
- 22:35that the camera
- 22:36has given us
- 22:37along with
- 22:38metadata
- 22:39for analysis
- 22:41and that's .tiff.
Discussion
A mail when somebody comments. No account needed.
The newsletter
Get our free newsletter with new instruments, prices and biotech news.