<div dir="ltr">Depends on where they occur? Cam you share the valgrind report?<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 5:47 PM, John Haiducek <span dir="ltr"><<a href="mailto:jhaiduce@gmail.com" target="_blank">jhaiduce@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When I run the following program under valgrind I get lots of warnings<br>
saying "Conditional jump or move depends on uninitialized values."<br>
Does this indicate that I'm doing something wrong, or are these false<br>
positives?<br>
<br>
John Haiducek<br>
<br>
<br>
#include "vtkImageData.h"<br>
#include "vtkImageViewer2.h"<br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkImageMapper.h><br>
#include <vtkLookupTable.h><br>
#include <vtkScalarBarActor.h><br>
#include <vtkRenderer.h><br>
#include <vtkImageActor.h><br>
#include <vtkScalarsToColors.h><br>
#include <vtkImageMapToWindowLevelColors.h><br>
<br>
int main(int argc, char *argv[]){<br>
<br>
vtkImageData*intensityImageData = vtkImageData::New();<br>
vtkImageViewer2*view=vtkImageViewer2::New();<br>
vtkImageMapper*imageMapper = vtkImageMapper::New();<br>
int width=400;<br>
int height=400;<br>
double*data=new double[width*height];<br>
<br>
for(int i=0;i<width*height;i++)<br>
data[i]=0;<br>
<br>
intensityImageData->SetDimensions(width,height,1);<br>
intensityImageData->SetNumberOfScalarComponents(1);<br>
intensityImageData->SetScalarTypeToDouble();<br>
intensityImageData->AllocateScalars();<br>
memcpy(intensityImageData->GetScalarPointer(),data,width*height*sizeof(double));<br>
view->SetInput(intensityImageData);<br>
<br>
vtkLookupTable*colorMap = vtkLookupTable::New();<br>
colorMap->SetHueRange(0.4,1.0);<br>
colorMap->SetValueRange(1.0,1.0);<br>
colorMap->SetRange(0,1);<br>
colorMap->Build();<br>
vtkImageMapToWindowLevelColors*colorMapper=view->GetWindowLevel();<br>
colorMapper->SetLookupTable(colorMap);<br>
colorMapper->SetInput(intensityImageData);<br>
colorMapper->SetLevel(10);<br>
colorMapper->SetWindow(255);<br>
vtkScalarBarActor*scalarBar = vtkScalarBarActor::New();<br>
scalarBar->S#include "vtkImageData.h"<br>
#include "vtkImageViewer2.h"<br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkImageMapper.h><br>
#include <vtkLookupTable.h><br>
#include <vtkScalarBarActor.h><br>
#include <vtkRenderer.h><br>
#include <vtkImageActor.h><br>
#include <vtkScalarsToColors.h><br>
#include <vtkImageMapToWindowLevelColors.h><br>
<br>
int main(int argc, char *argv[]){<br>
<br>
vtkImageData*intensityImageData = vtkImageData::New();<br>
vtkImageViewer2*view=vtkImageViewer2::New();<br>
vtkImageMapper*imageMapper = vtkImageMapper::New();<br>
int width=400;<br>
int height=400;<br>
double*data=new double[width*height];<br>
<br>
for(int i=0;i<width*height;i++)<br>
data[i]=0;<br>
<br>
intensityImageData->SetDimensions(width,height,1);<br>
intensityImageData->SetNumberOfScalarComponents(1);<br>
intensityImageData->SetScalarTypeToDouble();<br>
intensityImageData->AllocateScalars();<br>
memcpy(intensityImageData->GetScalarPointer(),data,width*height*sizeof(double));<br>
view->SetInput(intensityImageData);<br>
<br>
vtkLookupTable*colorMap = vtkLookupTable::New();<br>
colorMap->SetHueRange(0.4,1.0);<br>
colorMap->SetValueRange(1.0,1.0);<br>
colorMap->SetRange(0,1);<br>
colorMap->Build();<br>
vtkImageMapToWindowLevelColors*colorMapper=view->GetWindowLevel();<br>
colorMapper->SetLookupTable(colorMap);<br>
colorMapper->SetInput(intensityImageData);<br>
colorMapper->SetLevel(10);<br>
colorMapper->SetWindow(255);<br>
vtkScalarBarActor*scalarBar = vtkScalarBarActor::New();<br>
scalarBar->SetLookupTable(colorMap);<br>
scalarBar->SetTitle("Intensity");<br>
scalarBar->SetNumberOfLabels(4);<br>
<br>
view->GetRenderer()->AddActor2D(scalarBar);<br>
<br>
<br>
view->Render();<br>
<br>
intensityImageData->Delete();<br>
view->Delete();<br>
imageMapper->Delete();<br>
scalarBar->Delete();<br>
colorMap->Delete();<br>
<br>
delete data;<br>
return 0;<br>
}<br>
etLookupTable(colorMap);<br>
scalarBar->SetTitle("Intensity");<br>
scalarBar->SetNumberOfLabels(4);<br>
<br>
view->GetRenderer()->AddActor2D(scalarBar);<br>
<br>
<br>
view->Render();<br>
<br>
intensityImageData->Delete();<br>
view->Delete();<br>
imageMapper->Delete();<br>
scalarBar->Delete();<br>
colorMap->Delete();<br>
<br>
delete data;<br>
return 0;<br>
}<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>