[vtkusers] Conditional jump or move depends on uninitialized values(s)

Bill Lorensen bill.lorensen at gmail.com
Mon Jul 15 19:20:16 EDT 2013


Depends on where they occur? Cam you share the valgrind report?



On Mon, Jul 15, 2013 at 5:47 PM, John Haiducek <jhaiduce at gmail.com> wrote:

> When I run the following program under valgrind I get lots of warnings
> saying "Conditional jump or move depends on uninitialized values."
> Does this indicate that I'm doing something wrong, or are these false
> positives?
>
> John Haiducek
>
>
> #include "vtkImageData.h"
> #include "vtkImageViewer2.h"
> #include <vtkRenderWindowInteractor.h>
> #include <vtkImageMapper.h>
> #include <vtkLookupTable.h>
> #include <vtkScalarBarActor.h>
> #include <vtkRenderer.h>
> #include <vtkImageActor.h>
> #include <vtkScalarsToColors.h>
> #include <vtkImageMapToWindowLevelColors.h>
>
> int main(int argc, char *argv[]){
>
>   vtkImageData*intensityImageData = vtkImageData::New();
>   vtkImageViewer2*view=vtkImageViewer2::New();
>   vtkImageMapper*imageMapper = vtkImageMapper::New();
>   int width=400;
>   int height=400;
>   double*data=new double[width*height];
>
>   for(int i=0;i<width*height;i++)
>     data[i]=0;
>
>   intensityImageData->SetDimensions(width,height,1);
>   intensityImageData->SetNumberOfScalarComponents(1);
>   intensityImageData->SetScalarTypeToDouble();
>   intensityImageData->AllocateScalars();
>
> memcpy(intensityImageData->GetScalarPointer(),data,width*height*sizeof(double));
>   view->SetInput(intensityImageData);
>
>   vtkLookupTable*colorMap = vtkLookupTable::New();
>   colorMap->SetHueRange(0.4,1.0);
>   colorMap->SetValueRange(1.0,1.0);
>   colorMap->SetRange(0,1);
>   colorMap->Build();
>   vtkImageMapToWindowLevelColors*colorMapper=view->GetWindowLevel();
>   colorMapper->SetLookupTable(colorMap);
>   colorMapper->SetInput(intensityImageData);
>   colorMapper->SetLevel(10);
>   colorMapper->SetWindow(255);
>   vtkScalarBarActor*scalarBar = vtkScalarBarActor::New();
>   scalarBar->S#include "vtkImageData.h"
> #include "vtkImageViewer2.h"
> #include <vtkRenderWindowInteractor.h>
> #include <vtkImageMapper.h>
> #include <vtkLookupTable.h>
> #include <vtkScalarBarActor.h>
> #include <vtkRenderer.h>
> #include <vtkImageActor.h>
> #include <vtkScalarsToColors.h>
> #include <vtkImageMapToWindowLevelColors.h>
>
> int main(int argc, char *argv[]){
>
>   vtkImageData*intensityImageData = vtkImageData::New();
>   vtkImageViewer2*view=vtkImageViewer2::New();
>   vtkImageMapper*imageMapper = vtkImageMapper::New();
>   int width=400;
>   int height=400;
>   double*data=new double[width*height];
>
>   for(int i=0;i<width*height;i++)
>     data[i]=0;
>
>   intensityImageData->SetDimensions(width,height,1);
>   intensityImageData->SetNumberOfScalarComponents(1);
>   intensityImageData->SetScalarTypeToDouble();
>   intensityImageData->AllocateScalars();
>
> memcpy(intensityImageData->GetScalarPointer(),data,width*height*sizeof(double));
>   view->SetInput(intensityImageData);
>
>   vtkLookupTable*colorMap = vtkLookupTable::New();
>   colorMap->SetHueRange(0.4,1.0);
>   colorMap->SetValueRange(1.0,1.0);
>   colorMap->SetRange(0,1);
>   colorMap->Build();
>   vtkImageMapToWindowLevelColors*colorMapper=view->GetWindowLevel();
>   colorMapper->SetLookupTable(colorMap);
>   colorMapper->SetInput(intensityImageData);
>   colorMapper->SetLevel(10);
>   colorMapper->SetWindow(255);
>   vtkScalarBarActor*scalarBar = vtkScalarBarActor::New();
>   scalarBar->SetLookupTable(colorMap);
>   scalarBar->SetTitle("Intensity");
>   scalarBar->SetNumberOfLabels(4);
>
>   view->GetRenderer()->AddActor2D(scalarBar);
>
>
>   view->Render();
>
>   intensityImageData->Delete();
>   view->Delete();
>   imageMapper->Delete();
>   scalarBar->Delete();
>   colorMap->Delete();
>
>   delete data;
>   return 0;
> }
> etLookupTable(colorMap);
>   scalarBar->SetTitle("Intensity");
>   scalarBar->SetNumberOfLabels(4);
>
>   view->GetRenderer()->AddActor2D(scalarBar);
>
>
>   view->Render();
>
>   intensityImageData->Delete();
>   view->Delete();
>   imageMapper->Delete();
>   scalarBar->Delete();
>   colorMap->Delete();
>
>   delete data;
>   return 0;
> }
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130715/4828a551/attachment.htm>


More information about the vtkusers mailing list