int main()
{
  FloatVectorImageType::Pointer image = FloatVectorImageType::New();
  Testing::GetBlankImage(image.GetPointer(), 4);

  Mask::Pointer mask = Mask::New();
  Testing::GetFullyValidMask(mask.GetPointer());

  UnsignedCharScalarImageType::Pointer manualPriorityImage = UnsignedCharScalarImageType::New();
  Testing::GetBlankImage(manualPriorityImage.GetPointer());

  unsigned int patchRadius = 5;
  typedef PriorityConfidence ConfidencePriorityType;
  ConfidencePriorityType priorityConfidence(mask, patchRadius);
  
  PriorityManual<itk::Index<2>, UnsignedCharScalarImageType, ConfidencePriorityType>
      priority(manualPriorityImage, &priorityConfidence);

  itk::Index<2> filledPixel = {{0,0}};
  priority.Update(filledPixel);
  priority.SetManualPriorityImage(manualPriorityImage);

  itk::Index<2> queryPixel = {{0,0}};
  priority.ComputePriority(queryPixel);

  return EXIT_SUCCESS;
}
int main()
{
  FloatVectorImageType::Pointer image = FloatVectorImageType::New();
  Testing::GetBlankImage(image.GetPointer(), 4);

  Mask::Pointer mask = Mask::New();
  Testing::GetFullyValidMask(mask.GetPointer());

  unsigned int patchRadius = 5;
  PriorityCriminisi<itk::Index<2>, FloatVectorImageType> priority(image.GetPointer(), mask.GetPointer(), patchRadius);

  itk::Index<2> filledPixel;
  filledPixel.Fill(0);
  priority.Update(filledPixel);

  itk::Index<2> queryPixel = {{0,0}};
  priority.ComputePriority(queryPixel);

  return EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
  if(argc < 3)
  {
    throw std::runtime_error("Required arguments: inputFileName outputPrefix");
  }

  std::string inputFileName = argv[1];
  std::string outputPrefix = argv[2];

  std::cout << "Input: " << inputFileName << std::endl;
  std::cout << "Output prefix: " << outputPrefix << std::endl;

  typedef itk::ImageFileReader<FloatVectorImageType> ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName(inputFileName);
  reader->Update();

  ITKHelpers::WriteVectorImageAsRGB(reader->GetOutput(), outputPrefix + "/Image.mha");

  WriteImagePixelsToRGBSpace(reader->GetOutput(), outputPrefix + "/ImageColors.vtp");

  WriteClusteredPixelsInRGBSpace(reader->GetOutput(), 20, outputPrefix + "/ImageColorsClustered.vtp");

  FloatVectorImageType::Pointer blurred = FloatVectorImageType::New();
  //float blurVariance = 2.0f; // almost no visible blurring
  //float blurVariance = 10.0f; // slight blurring of concrete
  //float blurVariance = 30.0f;

  // TODO: Update this call to the new API
  //Helpers::AnisotropicBlurAllChannels<FloatVectorImageType>(reader->GetOutput(), blurred, blurVariance);

  ITKHelpers::WriteVectorImageAsRGB(blurred.GetPointer(), outputPrefix + "/BlurredImage.mha");

  WriteImagePixelsToRGBSpace(blurred, outputPrefix + "/BlurredImageColors.vtp");

  WriteClusteredPixelsInRGBSpace(blurred, 20, outputPrefix + "/BlurredImageColorsClustered.vtp");

  return EXIT_SUCCESS;
}
Ejemplo n.º 4
0
bool TestHasBracketOperator()
{
  {
  typedef itk::CovariantVector<int, 3> IntVectorType;

  static_assert(Helpers::HasBracketOperator<IntVectorType>::value,
              "TestHasBracketOperator for CovariantVector<int, 3> failed!");
  }

  {
  typedef itk::CovariantVector<unsigned char, 3> UCharVectorType;

  static_assert(Helpers::HasBracketOperator<UCharVectorType>::value,
              "TestHasBracketOperator for CovariantVector<unsigned char, 3> failed!");
  }

  {
  typedef itk::CovariantVector<float, 3> FloatVectorType;

  static_assert(Helpers::HasBracketOperator<FloatVectorType>::value,
              "TestHasBracketOperator for CovariantVector<float, 3> failed!");
  }

  {
  typedef itk::Image<itk::CovariantVector<float, 3>, 2> FloatVectorImageType;

  static_assert(Helpers::HasBracketOperator<FloatVectorImageType::PixelType>::value,
              "TestHasBracketOperator for CovariantVector<float, 3> failed!");
  }

  {
  typedef itk::Image<itk::CovariantVector<float, 3>, 2> FloatVectorImageType;
  FloatVectorImageType::Pointer image = FloatVectorImageType::New();

  TestHasBracketOperator_Template(image.GetPointer());
  }

  {
  typedef itk::Image<itk::CovariantVector<float, 3>, 2> FloatVectorImageType;
  itk::SmartPointer<FloatVectorImageType> image = FloatVectorImageType::New();

  TestHasBracketOperator_Template(image.GetPointer());
  TestHasBracketOperator_ConstTemplate(image.GetPointer());
  }

  {
  typedef itk::Image<itk::CovariantVector<float, 3>, 2> FloatVectorImageType;

  TestHasBracketOperator_Template2<FloatVectorImageType>();
  }

  {
  typedef itk::VariableLengthVector<int> VectorType;

  static_assert(Helpers::HasBracketOperator<VectorType>::value,
              "TestHasBracketOperator for VariableLengthVector failed!");
  }

  {
  typedef std::vector<int> VectorType;

  static_assert(Helpers::HasBracketOperator<VectorType>::value,
              "TestHasBracketOperator for std::vector failed!");
  }

  // This (intentionally) fails
//  {
//  static_assert(Helpers::HasBracketOperator<float>::value,
//              "TestHasBracketOperator for float failed!");
//  }

  return true;
}