How to show Detector Volume data in 3-D

This article shows how to create a CAD model to represent Detector Volume data in 3D. To do so automatically, a ZPL macro will need to be utilized. A sample macro is provided for this purpose.

Authored By Mike Tocci

Downloads

Article Attachments

Introduction

The Detector Volume object in OpticStudio is a very useful tool for detecting light inside a volume. It uses volume pixels, or voxels, to detect light. However, the OpticStudio interface currently allows these voxels to be viewed only in 2-D planes. This article will show you how to use OpticStudio to create intricate CAD models of the voxels in a Detector Volume, and a sample ZPL macro is given for use in creating these CAD models automatically. See the Article Attachments link for the sample macro.

Setting up the example

Unlike the Detector Rectangle object, which records light as it passes through square pixels arranged on a flat rectangle, the Detector Volume object records light as it passes through cubic volume-pixels, or voxels, arranged in a rectangular solid. This detector object is very powerful.

Start with a new lens in OpticStudio, and set it to Non-Sequential Mode. Insert three new objects into the NSC Editor. Below are the settings for Object 1 (note that any settings not mentioned here should be left with their default values):

Object Type = Source Diode
Y Position = 2.000
Z Position = 1.000
Tilt About X = 123.000
Tilt About Y = -16.000
# Layout Rays = 25
# Analysis Rays = 50000
X-Divergence = 10.000
Y-Divergence = 10.000 

Below are the settings for Object 2 (again, any settings not mentioned here should be left with their default values):

Object Type = Detector Volume
# X Pixels = 10
# Y Pixels = 10
# Z Pixels = 10

Note that we will use this Detector Volume to show absorbed flux; we will only generate data in regions which are inside an object that has some finite absorption.

Next we will create a cylindrical glass object, inside the Detector Volume, that will provide some absorption that can be detected.  Below are the settings for Object 3 (as before, any settings not mentioned here should be left with their default values): 

Object Type = Standard Lens
Inside Of = 2
Z Position = -0.750
Material = BK7
Clear 1 = 0.750
Edge 1 = 0.750
Thickness = 1.500
Clear 2 = 0.750
Edge 2 = 0.750

Now right-click on the ‘Detector Volume’ cell in the NSC Editor and then click the Draw tab. Set the Opacity of this object to 10%.

Next, right-click on the ‘Standard Lens’ cell in the NSC Editor and then click the Draw tab. Set the Opacity of this object to 30%.

Open up an NSC Shaded Model Layout (Analysis...NSC Shaded Model), and look at the setup:

NSC_Shaded_Model_Layout

We see that several rays pass through the BK7 cylinder, but because all rays are represented equally in the shaded model layout, irrespective of their relative intensity, it is impossible to tell from this view where most of the light energy is being absorbed. For that, we need to look at the Detector Volume.

Detector Volume data visualization using the Detector Viewer

Open a Ray Trace Control window (by clicking Analyze...Ray Trace), and make sure the “Use Polarization” check-box is the only one checked:

Ray_Trace_Control

Now click “Clear and Trace”

When OpticStudio has finished tracing rays, click “Exit” and then open a Detector Viewer (by clicking Analyze...Detector Viewer).  Input the following settings into the Detector Viewer:

Detector_Viewer

Click “OK” and you’ll see the following detector view:

Detector_View

This window shows us the absorbed flux as a function of position inside the detector volume. At the bottom of the window, we see that this graph represents “Z Plane 5 of 10. Z = -1E-1.” And while this window is up, we can press the left and right arrow keys to scroll through all the various Z Planes:

Detector_View_2

There are a couple of important facts to note about this Detector Viewer window for the Detector Volume object. First, as with standard Detector Rectangle objects, it can be difficult to ascertain the orientation of the detector with respect to the rest of the setup. For example, we see that the majority of the intensity in the detector is in the left half of the screen, but which way is that in the setup? And which direction is +z in the layout?

With the Detector Rectangle object, we could select “Color pixels by last analysis” to see how the detector image is oriented relative to the setup. But that feature isn't currently supported by the Detector Volume object. It might at times be helpful to see the detector viewer pixels in their proper size, location, and orientation relative to the rest of the setup.

Second, each Detector Viewer screen has an auto-scale feature, which changes the scale of the false color plot so that the maximum value for each 2-D plot is represented by the color “red”. For Detector Rectangles, this is a useful feature, as it gives the maximum possible color range for each Detector view. For Detector Volumes, this feature can be misleading, as it automatically scales each Z Plane view so that it shows the full color range, irrespective of the relative intensity from one Z Plane to the next. To fix this, we must scan through all the Z Planes (Luckily there are only 10 Z-planes in this simple example), and take note of what the highest “Peak Absorbed Flux” value is. Then we could go to Settings and set the “Max Plot Scale” to that value.

We can figure out all the values for pixel size, location, and orientation, but it seems tedious. Likewise, we can find the highest value of “Peak Absorbed Flux” and then set the “Max Plot Scale”, but in systems with a large number of Z Planes this can be tedious.

And anytime we find that things are getting tedious, we know it’s time to write a ZPL macro!

Structure of the “Voxel Maker.ZPL” macro

The basic structure for the voxel viewer macro we want is as follows:

  1. Obtain the detected intensity values for each voxel in the detector volume, and determine the maximum overall intensity value.
  2. Create one rectangular volume object for each voxel whose recorded intensity is greater than some threshold value
  3. Export all these rectangular volume objects as a single CAD object

The Voxel Maker.ZPL macro does all this, and a bit more. It will create several different CAD objects, each one with a different threshold cutoff value. Then it imports these CAD objects into the current lens file, so that the user may color the objects to match the different threshold values (red for the highest threshold value, followed by yellow, green, and blue).

The attached macro also minimizes the memory used (for files that have very large numbers of detector volume voxels) by saving multiple sub-systems of pixels, and then re-loading these sub-systems and finally exporting one, large CAD object for each threshold color.

Voxel Maker.ZPL can be downloaded from the "Article Attachments" link at the top of this article. Save the ZPL macro in the appropriate folder on your computer (By default this is Documents\Zemax\Macros), and then run it on the lens file we’ve just created.

You’ll need to supply the macro with some information, so just answer the requests that pop up on the ZPL Macro Input window. Note that default answers are given in brackets, and if you simply hit [enter] the default answer is taken. For the lens file we’ve just created, you can use the default answers for all except “use polarization?” which must be answered with ‘1’ so that the rays can be properly absorbed by the glass cylinder.

When the macro is finished running, you’ll just need to change the Draw colors of the four newly-created CAD objects (change the Draw color of the “voxel_red_object” to a red color, the Draw color of the “voxel_yellow_object” to a yellow color, and so on). Below is the resulting NSC Shaded Model layout:

NSC_Shaded_Model_Layout_2

You can clearly see where the ‘hot’ voxels are inside the glass cylinder. Keep in mind that this simple example had just 10 pixels in each of the x-, y-, and z-directions; there are 1000 voxels in the detector volume. A detector volume with finer pixels will have far more voxels.

The attached macro is designed to handle such large voxel numbers with ease. Of course, the resulting CAD object files will be quite large, and the production of these files will take some time. But the results can be truly illuminating. Below are some samples of voxel objects created using the attached macro for some more complex setups.

The image below was made using the file supplied with OpticStudio (in the directory {Zemax}\Samples\Non-sequential\Miscellaneous) called “voxel detector for flash lamp pumping.ZMX,” with the number of z-planes increased from 25 to 100. In the example below, the detector volume has 101 x 101 x 100 pixels, or over 1 million voxels.

Voxel_detector_for_flash_lamp_pumping

The next example shows how the “Voxel Maker.ZPL” macro is also useful for visualizing light patterns on the surfaces of complex objects. The image below was made by choosing a highly-absorbing material for the complex object, so that light rays would not penetrate beyond a single voxel into the object. With this method, it is now possible to use the entire surface of any complex object as a detector plane, as if the detector plane were draped over the object.

For this setup, an LED was positioned above and aimed at a mechanical mirror mount. The detector voxels clearly show the exact locations of the very brightest portions of illumination on the mirror mount, and they also show the exact size and shape of shadows (regions where no voxels are lit) in the illumination pattern.

Voxel_Maker

With the “Voxel Maker.ZPL” macro, it is now possible to visualize 3D stray light patterns over complex objects.

The final example shows how to use the “Voxel Maker.ZPL” macro to envision a detection volume, where an imaging detector is set up to view a volume of space that is being illuminated, as one might find in a detector for smoke or particulates. The image below shows the basic setup.

Voxel_Maker_basic_setup

A large lens (yellow) is placed in front of a high-power LED (blue-green). Light from this LED/lens system (rays shown in purple) illuminates a volume of space, where a sample of gas or particles will be introduced.

A very small detector (red) is placed inside a tube (purple) with a small lens (blue) at the front end. This detector is meant to view the same volume of space that is being illuminated by the LED/lens system. To see where the detector/lens system is looking, we replace the detector with a Source Rectangle:

Source Rectangle

Now there are rays (gray) showing exactly where the detector is looking. Looking at the layout above, it would be easy to assume that this system is set up very well, with the detector looking exactly at the brightest part of the LED illumination. We’re now going to go several steps further, in order to really evaluate how well this LED/detector system works.

We’ll add a detector volume to the system, as shown below.

Add_a_detector_volume

Next, we will run the “Voxel Maker.ZPL” macro, using only the LED rays at this time, in order to view the 3D pattern of the LED/lens system.

Using_only_the_LED_rays

We can see that the LED illumination pattern is well-aligned with the detector’s general imaging path. Note that the voxels in the above diagram are lit only when the irradiant flux on any given voxel exceeds a certain value. Some tuning of these threshold limit values (in the macro) is necessary in order to achieve the best quality picture.

Note also that the light pattern, especially the pattern of the blue voxels, appears to be shaped like a plume, as though light were bending around. However, there is still light in the regions of space where no voxels are lit: the light there just did not exceed the threshold chosen for the blue voxels.

Next, a material was applied to each of the newly-created voxel CAD objects. The absorption of each material was set to match the intensity level of light in each of the four (red, yellow, green, and blue) objects. For example, the red object had a threshold irradiance level twice as high as that of the yellow object. Therefore a material was created for the red object that had twice the absorption as that of the yellow object.

After all the voxel CAD objects were prepared in this way, light was projected out of the detector into the volume, and the “Voxel Maker.ZPL” macro was run once more. The image below shows the overlap between LED light and detector imaging (red/yellow). For reference, the main body of LED illumination is also shown in gray.

Overlap_between_LED_light_and_detector_imaging

The animation below shows how the entire system can easily be rotated and manipulated to help visualize the spatial characteristics of the illumination/detection overlap area.

Animation

KA-01366

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.