<div dir="ltr"><h1><a href="http://stackoverflow.com/questions/41582754/why-the-output-of-the-following-code-is-just-a-box" class="gmail-m_-774406634059374789gmail-question-hyperlink" target="_blank">Why the output of the following code is just a box?</a></h1><p><br></p><div class="gmail-m_-774406634059374789gmail-post-text">

<pre class="gmail-m_-774406634059374789gmail-lang-py gmail-m_-774406634059374789gmail-prettyprint gmail-m_-774406634059374789gmail-prettyprinted"><code><span class="gmail-m_-774406634059374789gmail-kwd">import</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk
</span><span class="gmail-m_-774406634059374789gmail-kwd">import</span><span class="gmail-m_-774406634059374789gmail-pln"> pickle
</span><span class="gmail-m_-774406634059374789gmail-kwd">from</span><span class="gmail-m_-774406634059374789gmail-pln"> numpy </span><span class="gmail-m_-774406634059374789gmail-kwd">import</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-pun">*</span><span class="gmail-m_-774406634059374789gmail-pln">


data_matrix </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-typ">Ilog</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkImageImport</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># The preaviusly created array is converted to a string of chars and imported.</span><span class="gmail-m_-774406634059374789gmail-pln">
data_string </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> data_matrix</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">tostring</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">CopyImportVoidPoi<wbr>nter</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">data_string</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> len</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">data_string</span><span class="gmail-m_-774406634059374789gmail-pun">))</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># The type of the newly imported data is set to unsigned char (uint8)</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetDataScalarType<wbr>ToUnsignedChar</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># must be told this is the case.</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetNumberOfScalar<wbr>Components</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># The following two functions describe how the data is stored and the dimensions of the array it is stored in. For this</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># simple case, all axes are of length 75 and begins with the first element. For other data, this is probably not the case.</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># I have to admit however, that I honestly don't know the difference between SetDataExtent() and SetWholeExtent() although</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># VTK complains if not both are used.</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetDataExtent</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">727</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">727</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">24</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetWholeExtent</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">727</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">727</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">24</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># The following class is used to store transparency-values for later retrieval. In our case, we want the value 0 to be</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># completely opaque whereas the three different cubes are given different transparency-values to show how it works.</span><span class="gmail-m_-774406634059374789gmail-pln">
alphaChannelFunc </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkPiecewiseFunction</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
alphaChannelFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

alphaChannelFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0.5</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.9</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
alphaChannelFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0.7</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.9</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
alphaChannelFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">


colorFunc </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkColorTransferFunction</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
colorFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddRGBPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

colorFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddRGBPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0.2</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.9</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.9</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.9</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
colorFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddRGBPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0.7</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.2</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.2</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0.2</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
colorFunc</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddRGBPoint</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># The preavius two classes stored properties. Because we want to apply these properties to the volume we want to render,</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># we have to store them in a class that stores volume properties.</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeProperty </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkVolumeProperty</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeProperty</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetColor</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">colorF<wbr>unc</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeProperty</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetScalarOpacit<wbr>y</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">alphaChannelFunc</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># This class describes how the volume is rendered (through ray tracing).   </span><span class="gmail-m_-774406634059374789gmail-pln">
compositeFunction </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkVolumeRayCastCompositeF<wbr>unction</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># We can finally create our volume. We also have to specify the data for it, as well as how the data will be rendered.</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeMapper </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkVolumeRayCastMapper</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeMapper</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetVolumeRayCastF<wbr>unction</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">compositeFunction</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
volumeMapper</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetInputConnectio<wbr>n</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">dataImporter</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">GetOutputPort</span><span class="gmail-m_-774406634059374789gmail-pun">()<wbr>)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># The class vtkVolume is used to pair the previously declared volume as well as the properties to be used when rendering that volume.</span><span class="gmail-m_-774406634059374789gmail-pln">
volume </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkVolume</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
volume</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetMapper</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">volumeMapper</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
volume</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetProperty</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">volumePrope<wbr>rty</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># With almost everything else ready, its time to initialize the renderer and window, as well as creating a method for exiting the application</span><span class="gmail-m_-774406634059374789gmail-pln">
renderer </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkRenderer</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">

 renderWin </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkRenderWindow</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderWin</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddRenderer</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">renderer</span><span class="gmail-m_-774406634059374789gmail-pun"><wbr>)</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderInteractor </span><span class="gmail-m_-774406634059374789gmail-pun">=</span><span class="gmail-m_-774406634059374789gmail-pln"> vtk</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-pln">vtkRenderWindowInteractor</span><span class="gmail-m_-774406634059374789gmail-pun">(<wbr>)</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderInteractor</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetRenderWind<wbr>ow</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">renderWin</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

 </span><span class="gmail-m_-774406634059374789gmail-com"># We add the volume to the renderer ...</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderer</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddVolume</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">volume</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
 </span><span class="gmail-m_-774406634059374789gmail-com"># ... set background color to white ...</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderer</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetBackground</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">0.5</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-lit">0.5</span><span class="gmail-m_-774406634059374789gmail-pun"><wbr>,</span><span class="gmail-m_-774406634059374789gmail-lit">0.7</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">
 </span><span class="gmail-m_-774406634059374789gmail-com"># ... and set window size.</span><span class="gmail-m_-774406634059374789gmail-pln">
 renderWin</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetSize</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">800</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-lit">800</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

 </span><span class="gmail-m_-774406634059374789gmail-com"># A simple function to be called when the user decides to quit the application.</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-kwd">def</span><span class="gmail-m_-774406634059374789gmail-pln"> exitCheck</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-pln">obj</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> event</span><span class="gmail-m_-774406634059374789gmail-pun">):</span><span class="gmail-m_-774406634059374789gmail-pln">
    </span><span class="gmail-m_-774406634059374789gmail-kwd">if</span><span class="gmail-m_-774406634059374789gmail-pln"> obj</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">GetEventPending</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-pun">!=</span><span class="gmail-m_-774406634059374789gmail-pln"> </span><span class="gmail-m_-774406634059374789gmail-lit">0</span><span class="gmail-m_-774406634059374789gmail-pun">:</span><span class="gmail-m_-774406634059374789gmail-pln">
        obj</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">SetAbortRender</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-lit">1</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

</span><span class="gmail-m_-774406634059374789gmail-com"># Tell the application to use the function as an exit check.</span><span class="gmail-m_-774406634059374789gmail-pln">
renderWin</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">AddObserver</span><span class="gmail-m_-774406634059374789gmail-pun">(</span><span class="gmail-m_-774406634059374789gmail-str">"<wbr>AbortCheckEvent"</span><span class="gmail-m_-774406634059374789gmail-pun">,</span><span class="gmail-m_-774406634059374789gmail-pln"> exitCheck</span><span class="gmail-m_-774406634059374789gmail-pun">)</span><span class="gmail-m_-774406634059374789gmail-pln">

renderInteractor</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">Initialize</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
</span><span class="gmail-m_-774406634059374789gmail-com"># Because nothing will be rendered without any input, we order the first render manually before control is handed over to the main-loop.</span><span class="gmail-m_-774406634059374789gmail-pln">
renderWin</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">Render</span><span class="gmail-m_-774406634059374789gmail-pun">()</span><span class="gmail-m_-774406634059374789gmail-pln">
renderInteractor</span><span class="gmail-m_-774406634059374789gmail-pun">.</span><span class="gmail-m_-774406634059374789gmail-typ">Start</span><span class="gmail-m_-774406634059374789gmail-pun">()</span></code></pre>

<p>Ilog is logical matrix of size 728x728x25 whose cross-section looks like</p>

<p><a href="https://i.stack.imgur.com/Z8qCP.png" rel="nofollow noreferrer" target="_blank"><img src="https://i.stack.imgur.com/Z8qCP.png" alt="enter image description here" class="gmail-CToWUd"></a></p>

<p>In this image the red color signifies the value 1 and the blue color signifies the value 0.</p>

<p>but when the above code is compiled the output is always a box like </p>

<p><a href="https://i.stack.imgur.com/Q6ESB.png" rel="nofollow noreferrer" target="_blank"><img src="https://i.stack.imgur.com/Q6ESB.png" alt="enter image description here" class="gmail-CToWUd"></a>.</p>

<p>The matrix contains values just zeros and ones. Using that logic the 
value with zeros have given full transparency and the values with zero 
have full opacity.</p>
    <br><br></div><div class="gmail-m_-774406634059374789gmail-post-text">The question can also be found on: <a href="http://stackoverflow.com/questions/41582754/why-the-output-of-the-following-code-is-just-a-box" target="_blank">http://stackoverflow.com/<wbr>questions/41582754/why-the-<wbr>output-of-the-following-code-<wbr>is-just-a-box</a>.<br><br></div><div class="gmail-m_-774406634059374789gmail-post-text">Thanking you<br><br><br></div><div class="gmail-m_-774406634059374789gmail-post-text">Best Regards,<br></div>Shaleen Jain</div>