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
_______________________________________________
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

Reply via email to