44 int main(
int argc,
char * argv[])
49 for (
int i = 0; i < argc; ++i)
50 std::cerr << argv[i] << std::endl;
51 std::cerr <<
"Usage: " << argv[0] <<
" inputImageFile ";
52 std::cerr <<
" outputSegmentsImageFile length width ";
53 std::cerr <<
" PixelSuppressionRadiusX PixelSuppressionAngularBeam ";
55 std::cerr <<
" LocalHoughRadiusX LocalHoughRadiusY LocalHoughNumberOfLines";
56 std::cerr <<
" FillGapsRadius FillGapsAngularBeam" << std::endl;
70 typedef float InternalPixelType;
71 typedef unsigned char OutputPixelType;
93 InternalImageType> DetectorType;
95 InternalImageType> ExtractorType;
130 OutputImageType> RescalerType;
141 ReaderType::Pointer reader = ReaderType::New();
142 DetectorType::Pointer detector = DetectorType::New();
143 ExtractorType::Pointer extractor = ExtractorType::New();
153 RescalerType::Pointer rescaler = RescalerType::New();
154 WriterType::Pointer writer = WriterType::New();
157 reader->SetFileName(argv[1]);
170 rescaler->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min());
171 rescaler->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max());
184 detector->SetInput(reader->GetOutput());
185 extractor->SetInputImage(detector->GetOutput());
186 extractor->SetInputImageDirection(detector->GetOutputDirection());
187 extractor->SetLineValue(0.);
188 rescaler->SetInput(extractor->GetOutput());
189 writer->SetInput(rescaler->GetOutput());
202 detector->SetLengthLine(atoi(argv[3]));
203 detector->SetWidthLine(atoi(argv[4]));
205 unsigned int PixelSuppressionRadiusX((
unsigned int) ::atoi(argv[5]));
206 float PixelSuppressionAngularBeam((
float) ::atof(argv[6]));
208 unsigned int LocalHoughRadiusX((
unsigned int) ::atoi(argv[7]));
209 unsigned int LocalHoughRadiusY((
unsigned int) ::atoi(argv[8]));
210 unsigned int LocalHoughNumberOfLines((
unsigned int) ::atoi(argv[9]));
212 float FillGapsRadius((
float) ::atoi(argv[10]));
213 float FillGapsAngularBeam((
float) ::atof(argv[11]));
215 ExtractorType::SizeType PixelSuppressionRadius;
216 PixelSuppressionRadius[0] = PixelSuppressionRadiusX;
217 PixelSuppressionRadius[1] = PixelSuppressionRadiusX;
219 extractor->SetPixelSuppressionRadius(PixelSuppressionRadius);
220 extractor->SetPixelSuppressionAngularBeam(PixelSuppressionAngularBeam);
222 ExtractorType::SizeType LocalHoughRadius;
223 LocalHoughRadius[0] = LocalHoughRadiusX;
224 LocalHoughRadius[1] = LocalHoughRadiusY;
226 extractor->SetLocalHoughRadius(LocalHoughRadius);
227 extractor->SetLocalHoughNumberOfLines(LocalHoughNumberOfLines);
229 extractor->SetFillGapsRadius(FillGapsRadius);
230 extractor->SetFillGapsAngularBeam(FillGapsAngularBeam);
249 writer->SetFileName(argv[2]);