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

John Haiducek jhaiduce at gmail.com
Mon Jul 15 17:47:28 EDT 2013


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;
}



More information about the vtkusers mailing list