Home > Software > TMSB Tutorial 4D: Klaus D. Schmitt Custom Colour-Processing Matrix
TMSB Tutorial 4D: Klaus D. Schmitt Custom Colour-Processing Matrix
This tutorial describes the process for creating a custom input and processing configuration that can be easily modified to provide exactly the output you're looking for, instead of the vast number of permutations that The Mirror's Surface Breaks will normally generate. It is based on a request by Dr. Klaus D. Schmitt, who wanted effectively a reconfigurable multiplication matrix to map input images to false-colour output.
Before getting into how to build this configuration, it's important to take a detour and discuss the model I recommend for coming up with input and processing configurations in TMSB, because this configuration breaks those rules, and it's important to understand why those rules are recommended before doing that.
TMSB provides an abstraction layer between the input images and the processing configuration in the form of "special band" definitions: near infrared, red, ultraviolet-A, and so on. This is because different input configurations may contain the same spectral bands, but in different files and/or channels, but if the processing configuration is defined in terms of the special bands, those different input configurations can all benefit from the same processing configuration.
For example, the various "Vegetation Index" processing configurations are based around methods like NDVI, in which a mathematical operation is performed using the near infrared and red imagery to generate a map of where vegetation is likely to be, as well as give an idea of its general health (see Calculated Greyscale Images for a discussion of this topic). Because those configuration use e.g. the "near infrared" and "red" special bands instead of e.g. "IR1.TIF, channel 1" and "Red.TIF, channel 1", they work unchanged with all of the input types that TMSB supports (multispectral photography, OnEarth satellite imagery, and so on).
The idea here is that if a particular image compositing method is useful for one type of multispectral imaging, it's probably useful (or at least interesting) for others that capture the same spectral bands.
To phrase this another way, if you have a multispectrally-converted Nikon DSLR and the common set of filters and are processing the resulting images with TMSB, I encourage you to think of the image data as being e.g. "near infrared", "red", "green", "blue", "ultraviolet-A from about 400nm to about 380nm", and "ultraviolet-A from about 380nm to about 360nm", instead of "an infrared image, a visible-light image, and an ultraviolet image, each of which contain three channels". That is, think of the images in terms of which spectral bands they represent, not the form that they happen to occupy on disk at any given time.
Now that we've covered the recommended approach, we'll discuss the configuration that uses the non-recommended approach. In this case, Dr. Schmitt is an expert scientist who knows exactly what he has to work with, and how he wants to transform those images. For Star Trek fans, this is the equivalent of Mr. Scott or Geordi LaForge using warp engine settings other than the ones that the designers at Utopia Planitia put in the warp engine manual: it's OK for them to do it because they know what they're doing, but if Ensign Greenhorn Butterfingers starts tweaking around the intermix settings, everyone had better run for the nearest escape pod.
These instructions assume that the reader has gone through all of the previous tutorials in this section.
Like all of the tutorial configuration files, complete (and tested) versions of the results below are included in the Tutorial subdirectory of TMSB_Config wherever you unpacked the software to (TMSB version 1.2 or later). These can be used to refer to if you run into trouble, or you can just copy them into your TMSB_Config directory if you would rather just use them instead of know how to create custom configurations.
Input Configuration
The standard input configurations assume that the near infrared and ultraviolet source images are greyscale, so the first phase of this example involves building a custom input configuration to make all three channels of colour near infrared and ultraviolet images available for use by the custom processing configuration which will be defined in the second phase.
Processing Configuration
Making effective use of the custom input configuration requires a custom processing configuration. If you attempt to use the input configuration defined above in the standard "generate a bunch of permutations" mode of TMSB, you will end up with a huge number of images, most of which are identical to a lot of the others. This is a situation where (like Dr. Schmitt) you need to define more or less exactly what you want each output image to consist of.
<StatisticalGreyscaleCubes>
</StatisticalGreyscaleCubes>
<CustomGreyscaleChannels>
</CustomGreyscaleChannels>
<CombinedBandChannels>
</CombinedBandChannels>
<CalculatedChannelSets>
</CalculatedChannelSets>
<CustomThreeChannelImages>
</CustomThreeChannelImages>
<DCSVariations>
</DCSVariations>
<TintMapping>
</TintMapping>
<GradientMapping>
</GradientMapping>
<GenerateStatisticalChannels>
false
</GenerateStatisticalChannels>
<GenerateCalculatedChannels>
false
</GenerateCalculatedChannels>
<GenerateCustomChannels>
false
</GenerateCustomChannels>
<GenerateTintedImages>
false
</GenerateTintedImages>
<GenerateGradientImages>
false
</GenerateGradientImages>
<GenerateThreeChannelImages>
false
</GenerateThreeChannelImages>
<GenerateStandardThreeChannelImages>
false
</GenerateStandardThreeChannelImages>
<GenerateCustomThreeChannelImages>
false
</GenerateCustomThreeChannelImages>
<GenerateCalculatedThreeChannelImages>
false
</GenerateCalculatedThreeChannelImages>
<GenerateLumaColourImages>
false
</GenerateLumaColourImages>
<GenerateDCSImages>
false
</GenerateDCSImages>
<GenerateStatisticalImageThreeChannelPermutations>
false
</GenerateStatisticalImageThreeChannelPermutations>
<GenerateStatisticalImageThreeChannelPermutationsUnrestricted>
false
</GenerateStatisticalImageThreeChannelPermutationsUnrestricted>
<GenerateLumaColourVariationsFromIndividualBands>
false
</GenerateLumaColourVariationsFromIndividualBands>
<GenerateLumaColourVariationsFromCombinedChannels>
false
</GenerateLumaColourVariationsFromCombinedChannels>
<GenerateLumaColourVariationsFromStatisticalChannels>
false
</GenerateLumaColourVariationsFromStatisticalChannels>
<GenerateLumaColourVariationsFromThreeChannelImages>
false
</GenerateLumaColourVariationsFromThreeChannelImages>
<GenerateLumaColourVariationsFromDCSImages>
false
</GenerateLumaColourVariationsFromDCSImages>
<GenerateDCSImagesFromIndividualChannels>
false
</GenerateDCSImagesFromIndividualChannels>
<GenerateDCSImagesFromCombinedChannels>
false
</GenerateDCSImagesFromCombinedChannels>
<GenerateDCSImagesFromCustomThreeChannelImages>
false
</GenerateDCSImagesFromCustomThreeChannelImages>
<GenerateDCSEnhancedContrast>
false
</GenerateDCSEnhancedContrast>
<CustomGreyscaleChannel>
<ChannelName>
Custom_Mapping-Red
</ChannelName>
<Type>
CustomScriptCode
</Type>
<CustomScriptCode>
= (%ChannelByName:NIR(1)% * 1.0) + (%SpecialBand:Red% * 0.0) + (%ChannelByName:UVA(1)% * 0.0)
</CustomScriptCode>
<UseAsLuminanceChannel>
false
</UseAsLuminanceChannel>
<UseAsThreeChannelChannel>
false
</UseAsThreeChannelChannel>
</CustomGreyscaleChannel>
<CustomGreyscaleChannel>
<ChannelName>
Custom_Mapping-Green
</ChannelName>
<Type>
CustomScriptCode
</Type>
<CustomScriptCode>
= (%ChannelByName:NIR(2)% * 0.0) + (%SpecialBand:Green% * 1.0) + (%ChannelByName:UVA(2)% * 0.0)
</CustomScriptCode>
<UseAsLuminanceChannel>
false
</UseAsLuminanceChannel>
<UseAsThreeChannelChannel>
false
</UseAsThreeChannelChannel>
</CustomGreyscaleChannel>
<CustomGreyscaleChannel>
<ChannelName>
Custom_Mapping-Blue
</ChannelName>
<Type>
CustomScriptCode
</Type>
<CustomScriptCode>
= (%ChannelByName:NIR(3)% * 0.0) + (%SpecialBand:Blue% * 0.0) + (%ChannelByName:UVA(3)% * 1.0)
</CustomScriptCode>
<UseAsLuminanceChannel>
false
</UseAsLuminanceChannel>
<UseAsThreeChannelChannel>
false
</UseAsThreeChannelChannel>
</CustomGreyscaleChannel>
<CustomThreeChannelImage>
<UserDefinedName>
FC-3C-Custom_Mapping
</UserDefinedName>
<RedChannelName>
Custom_Mapping-Red
</RedChannelName>
<GreenChannelName>
Custom_Mapping-Green
</GreenChannelName>
<BlueChannelName>
Custom_Mapping-Blue
</BlueChannelName>
<IncludeInSecondOrderImages>
true
</IncludeInSecondOrderImages>
<OutputTransformation>
Normalize: Standard
</OutputTransformation>
</CustomThreeChannelImage>
Output Configuration (Optional)
By default, TMSB will not overwrite existing files in the output directory. This becomes an inconvenience when using this type of reconfigurable processing configuration, because without changing that behaviour, you'll need to manually clean out the output directory every time you change the coefficients in the processing matrix.
To create a custom output configuration that forces overwriting, you can follow these steps. Be extremely careful, because it will introduce an enormous performance penalty when using TMSB with other types of processing configurations.
<Warnings>
!!!DANGER: OVERWRITES EXISTING FILES!!!EVEN IF IT TURNS OUT THAT I DIDN'T ACTUALLY WANT THEM OVERWRITTEN!!!
</Warnings>