[ITK-dev] Threshold setting

Marco Dev marco.dev.open at gmail.com
Tue Sep 22 12:39:01 EDT 2015


HI,
 I use double scaler type from input but work with (Black or white )
threshold setting   My code is follow bellow
int apply = 0;
 imageThreshold->SetInputConnection(firstColorMapper->GetOutputPort());
  imageThreshold->ReplaceInOn();
  imageThreshold->SetInValue(255);
 imageThreshold->ReplaceOutOn();
  imageThreshold->SetOutValue(255);

imageThreshold->SetOutputScalarType(fixedConnector->GetOutput()->GetScalarType());
//double
  imageThreshold->ThresholdBetween(VTK_SHORT_MIN, VTK_SHORT_MAX);
  imageThreshold->ThresholdBetween( -3495, 2161 );
  imageThreshold->SetOutValue(apply ? 0 : 255);
  imageThreshold->Update();



  double low   = (!enableThreshold) ? range[0] : lowThreshold;
  double upper = (!enableThreshold) ? range[1] : upperThreshold;


    vtkSmartPointer<vtkImageThreshold> imageThreshold2 =
    vtkSmartPointer<vtkImageThreshold>::New();
 // imageThreshold2->SetInputData(mImage);
    imageThreshold2->SetInputConnection(secondColorMapper->GetOutputPort());
  imageThreshold2->ReplaceInOn();
   imageThreshold2->SetInValue(255);
  imageThreshold2->ReplaceOutOn();
  imageThreshold2->SetOutValue(255);
 imageThreshold2->SetOutputScalarType(fixedConnector->GetOutput()->GetScalarType());
//double
 imageThreshold2->ThresholdBetween(VTK_SHORT_MIN, VTK_SHORT_MAX);
  imageThreshold2->ThresholdBetween( 160, 6088 );
  imageThreshold2->SetOutValue(apply ? 0 : 255);
  imageThreshold2->Update();


    Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20150922/83bd7aa6/attachment.html>


More information about the Insight-developers mailing list