[ITK] [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/community/attachments/20150922/83bd7aa6/attachment.html>
-------------- next part --------------
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list