or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

core-data-structures.mdimage-processing.mdindex.mdio-operations.mdmathematical-operations.mdmesh-processing.mdregistration.mdsegmentation.mdspatial-objects.md

segmentation.mddocs/

0

# Segmentation Algorithms

1

2

ITK provides comprehensive algorithms for medical image segmentation, including region growing, level set methods, clustering techniques, and watershed segmentation. These algorithms enable identification and classification of anatomical structures in medical images.

3

4

## Region Growing Methods

5

6

### ConnectedThresholdImageFilter

7

8

Segments connected regions based on intensity thresholds.

9

10

```cpp { .api }

11

template<typename TInputImage, typename TOutputImage>

12

class ConnectedThresholdImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>

13

{

14

public:

15

typedef ConnectedThresholdImageFilter Self;

16

typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;

17

typedef SmartPointer<Self> Pointer;

18

typedef SmartPointer<const Self> ConstPointer;

19

20

static Pointer New();

21

22

// Seed points

23

void SetSeed(const IndexType & seed);

24

void AddSeed(const IndexType & seed);

25

void ClearSeeds();

26

27

// Threshold values

28

void SetLower(const InputImagePixelType & thresh);

29

void SetUpper(const InputImagePixelType & thresh);

30

itkGetConstMacro(Lower, InputImagePixelType);

31

itkGetConstMacro(Upper, InputImagePixelType);

32

33

// Output values

34

void SetReplaceValue(const OutputImagePixelType & value);

35

itkGetConstMacro(ReplaceValue, OutputImagePixelType);

36

37

// Connectivity

38

void SetConnectivity(ConnectivityEnumType connectivity);

39

itkGetConstMacro(Connectivity, ConnectivityEnumType);

40

};

41

```

42

43

### ConfidenceConnectedImageFilter

44

45

Adaptive region growing with automatic threshold computation.

46

47

```cpp { .api }

48

template<typename TInputImage, typename TOutputImage>

49

class ConfidenceConnectedImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>

50

{

51

public:

52

typedef ConfidenceConnectedImageFilter Self;

53

typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;

54

typedef SmartPointer<Self> Pointer;

55

typedef SmartPointer<const Self> ConstPointer;

56

57

static Pointer New();

58

59

// Seed points

60

void SetSeed(const IndexType & seed);

61

void AddSeed(const IndexType & seed);

62

void ClearSeeds();

63

64

// Confidence parameters

65

void SetMultiplier(double multiplier);

66

itkGetConstMacro(Multiplier, double);

67

68

void SetNumberOfIterations(unsigned int numberOfIterations);

69

itkGetConstMacro(NumberOfIterations, unsigned int);

70

71

// Output value

72

void SetReplaceValue(const OutputImagePixelType & value);

73

itkGetConstMacro(ReplaceValue, OutputImagePixelType);

74

75

// Computed statistics

76

itkGetConstMacro(Mean, InputRealType);

77

itkGetConstMacro(Variance, InputRealType);

78

79

// Initial neighborhood radius

80

void SetInitialNeighborhoodRadius(unsigned int radius);

81

itkGetConstMacro(InitialNeighborhoodRadius, unsigned int);

82

};

83

```

84

85

### IsolatedConnectedImageFilter

86

87

Region growing between two seed points with automatic threshold selection.

88

89

```cpp { .api }

90

template<typename TInputImage, typename TOutputImage>

91

class IsolatedConnectedImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>

92

{

93

public:

94

typedef IsolatedConnectedImageFilter Self;

95

typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;

96

typedef SmartPointer<Self> Pointer;

97

typedef SmartPointer<const Self> ConstPointer;

98

99

static Pointer New();

100

101

// Seed points

102

void SetSeed1(const IndexType & seed);

103

void SetSeed2(const IndexType & seed);

104

void AddSeed1(const IndexType & seed);

105

void AddSeed2(const IndexType & seed);

106

void ClearSeeds1();

107

void ClearSeeds2();

108

109

// Threshold bounds

110

void SetLower(const InputImagePixelType & thresh);

111

void SetUpper(const InputImagePixelType & thresh);

112

itkGetConstMacro(Lower, InputImagePixelType);

113

itkGetConstMacro(Upper, InputImagePixelType);

114

115

// Output values

116

void SetReplaceValue(const OutputImagePixelType & value);

117

itkGetConstMacro(ReplaceValue, OutputImagePixelType);

118

119

// Results

120

itkGetConstMacro(IsolatedValue, InputImagePixelType);

121

itkGetConstMacro(IsolatedValueTolerance, InputImagePixelType);

122

void SetIsolatedValueTolerance(const InputImagePixelType & tolerance);

123

124

// Search direction

125

void SetFindUpperThreshold(bool findUpperThreshold);

126

itkGetConstMacro(FindUpperThreshold, bool);

127

};

128

```

129

130

## Level Set Methods

131

132

### SegmentationLevelSetImageFilter

133

134

Base class for level set segmentation methods.

135

136

```cpp { .api }

137

template<typename TInputImage, typename TFeatureImage, typename TOutputPixelType>

138

class SegmentationLevelSetImageFilter : public SparseFieldLevelSetImageFilter<TInputImage, TOutputPixelType>

139

{

140

public:

141

typedef SegmentationLevelSetImageFilter Self;

142

typedef SparseFieldLevelSetImageFilter<TInputImage, TOutputPixelType> Superclass;

143

typedef SmartPointer<Self> Pointer;

144

typedef SmartPointer<const Self> ConstPointer;

145

146

// Feature image

147

virtual void SetFeatureImage(const FeatureImageType * featureImage);

148

const FeatureImageType * GetFeatureImage() const;

149

150

// Speed image

151

virtual void SetSpeedImage(const SpeedImageType * speedImage);

152

const SpeedImageType * GetSpeedImage() const;

153

154

// Advection image

155

virtual void SetAdvectionImage(const VectorImageType * advectionImage);

156

const VectorImageType * GetAdvectionImage() const;

157

158

// Level set function parameters

159

void SetMaximumCurvatureTimeStep(double maxTimeStep);

160

void SetMaximumPropagationTimeStep(double maxTimeStep);

161

itkGetConstMacro(MaximumCurvatureTimeStep, double);

162

itkGetConstMacro(MaximumPropagationTimeStep, double);

163

164

// Term weights

165

void SetCurvatureScaling(ValueType curvatureScaling);

166

void SetPropagationScaling(ValueType propagationScaling);

167

void SetAdvectionScaling(ValueType advectionScaling);

168

itkGetConstMacro(CurvatureScaling, ValueType);

169

itkGetConstMacro(PropagationScaling, ValueType);

170

itkGetConstMacro(AdvectionScaling, ValueType);

171

172

// Evolution parameters

173

void SetMaximumRMSError(ValueType maxRMSError);

174

void SetNumberOfIterations(unsigned int numberOfIterations);

175

itkGetConstMacro(MaximumRMSError, ValueType);

176

itkGetConstMacro(NumberOfIterations, unsigned int);

177

178

// Initialization

179

void SetInitialImage(const InitialImageType * initialImage);

180

};

181

```

182

183

### GeodesicActiveContourLevelSetImageFilter

184

185

Geodesic active contour segmentation.

186

187

```cpp { .api }

188

template<typename TInputImage, typename TFeatureImage, typename TOutputPixelType>

189

class GeodesicActiveContourLevelSetImageFilter : public SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType>

190

{

191

public:

192

typedef GeodesicActiveContourLevelSetImageFilter Self;

193

typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;

194

typedef SmartPointer<Self> Pointer;

195

typedef SmartPointer<const Self> ConstPointer;

196

197

static Pointer New();

198

199

// Derivative sigma for feature image gradient

200

void SetDerivativeSigma(float derivativeSigma);

201

itkGetConstMacro(DerivativeSigma, float);

202

203

protected:

204

virtual void GenerateData() ITK_OVERRIDE;

205

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

206

};

207

```

208

209

### ShapeDetectionLevelSetImageFilter

210

211

Shape detection level set segmentation.

212

213

```cpp { .api }

214

template<typename TInputImage, typename TFeatureImage, typename TOutputPixelType>

215

class ShapeDetectionLevelSetImageFilter : public SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType>

216

{

217

public:

218

typedef ShapeDetectionLevelSetImageFilter Self;

219

typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;

220

typedef SmartPointer<Self> Pointer;

221

typedef SmartPointer<const Self> ConstPointer;

222

223

static Pointer New();

224

225

protected:

226

virtual void GenerateData() ITK_OVERRIDE;

227

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

228

};

229

```

230

231

### FastMarchingImageFilter

232

233

Fast marching method for distance transform and initialization.

234

235

```cpp { .api }

236

template<typename TLevelSet, typename TSpeedImage>

237

class FastMarchingImageFilter : public ImageToImageFilter<TSpeedImage, TLevelSet>

238

{

239

public:

240

typedef FastMarchingImageFilter Self;

241

typedef ImageToImageFilter<TSpeedImage, TLevelSet> Superclass;

242

typedef SmartPointer<Self> Pointer;

243

typedef SmartPointer<const Self> ConstPointer;

244

245

static Pointer New();

246

247

// Node types

248

enum LabelType { FarPoint, AlivePoint, TrialPoint };

249

250

// Seed points

251

typedef LevelSetNode<PixelType, itkGetStaticConstMacro(SetDimension)> NodeType;

252

typedef VectorContainer<unsigned int, NodeType> NodeContainer;

253

typedef typename NodeContainer::Pointer NodeContainerPointer;

254

255

void SetTrialPoints(NodeContainer * trialPoints);

256

NodeContainerPointer GetTrialPoints();

257

258

void SetAlivePoints(NodeContainer * alivePoints);

259

NodeContainerPointer GetAlivePoints();

260

261

// Stopping criteria

262

void SetStoppingValue(double stoppingValue);

263

itkGetConstMacro(StoppingValue, double);

264

265

// Output size specification

266

void SetOutputSize(const OutputSizeType & size);

267

void SetOutputRegion(const OutputRegionType & region);

268

void SetOutputSpacing(const OutputSpacingType & spacing);

269

void SetOutputOrigin(const OutputPointType & origin);

270

void SetOutputDirection(const OutputDirectionType & direction);

271

272

// Override connectivity

273

void SetOverrideOutputInformation(bool overrideOutputInformation);

274

itkGetConstMacro(OverrideOutputInformation, bool);

275

276

protected:

277

virtual void GenerateData() ITK_OVERRIDE;

278

virtual void GenerateOutputInformation() ITK_OVERRIDE;

279

virtual void EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE;

280

};

281

```

282

283

## Watershed Segmentation

284

285

### WatershedImageFilter

286

287

Watershed segmentation for region partitioning.

288

289

```cpp { .api }

290

template<typename TInputImage>

291

class WatershedImageFilter : public ImageToImageFilter<TInputImage, Image<IdentifierType, TInputImage::ImageDimension>>

292

{

293

public:

294

typedef WatershedImageFilter Self;

295

typedef ImageToImageFilter<TInputImage, Image<IdentifierType, TInputImage::ImageDimension>> Superclass;

296

typedef SmartPointer<Self> Pointer;

297

typedef SmartPointer<const Self> ConstPointer;

298

299

static Pointer New();

300

301

// Threshold parameters

302

void SetThreshold(double threshold);

303

itkGetConstMacro(Threshold, double);

304

305

void SetLevel(double level);

306

itkGetConstMacro(Level, double);

307

308

// Mark watershed line

309

void SetMarkWatershedLine(bool markWatershedLine);

310

itkGetConstMacro(MarkWatershedLine, bool);

311

312

// Fully connected watersheds

313

void SetFullyConnected(bool fullyConnected);

314

itkGetConstMacro(FullyConnected, bool);

315

316

protected:

317

virtual void GenerateData() ITK_OVERRIDE;

318

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

319

};

320

```

321

322

### MorphologicalWatershedImageFilter

323

324

Morphological watershed transformation.

325

326

```cpp { .api }

327

template<typename TInputImage, typename TOutputImage>

328

class MorphologicalWatershedImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>

329

{

330

public:

331

typedef MorphologicalWatershedImageFilter Self;

332

typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;

333

typedef SmartPointer<Self> Pointer;

334

typedef SmartPointer<const Self> ConstPointer;

335

336

static Pointer New();

337

338

// Watershed parameters

339

void SetLevel(InputImagePixelType level);

340

itkGetConstMacro(Level, InputImagePixelType);

341

342

void SetMarkWatershedLine(bool markWatershedLine);

343

itkGetConstMacro(MarkWatershedLine, bool);

344

345

void SetFullyConnected(bool fullyConnected);

346

itkGetConstMacro(FullyConnected, bool);

347

348

protected:

349

virtual void GenerateData() ITK_OVERRIDE;

350

virtual void EnlargeOutputRequestedRegion(DataObject * output) ITK_OVERRIDE;

351

};

352

```

353

354

## Clustering Methods

355

356

### KMeansImageClassificationFilter

357

358

K-means clustering for image segmentation.

359

360

```cpp { .api }

361

template<typename TInputImage>

362

class KMeansImageClassificationFilter : public ImageToImageFilter<TInputImage, Image<unsigned char, TInputImage::ImageDimension>>

363

{

364

public:

365

typedef KMeansImageClassificationFilter Self;

366

typedef ImageToImageFilter<TInputImage, Image<unsigned char, TInputImage::ImageDimension>> Superclass;

367

typedef SmartPointer<Self> Pointer;

368

typedef SmartPointer<const Self> ConstPointer;

369

370

static Pointer New();

371

372

// Number of classes

373

void SetNumberOfClasses(unsigned int numberOfClasses);

374

itkGetConstMacro(NumberOfClasses, unsigned int);

375

376

// Maximum iterations

377

void SetMaximumNumberOfIterations(unsigned int maximumNumberOfIterations);

378

itkGetConstMacro(MaximumNumberOfIterations, unsigned int);

379

380

// Initial means

381

void SetClassMeans(const MeansContainer & classMeans);

382

itkGetConstReferenceMacro(ClassMeans, MeansContainer);

383

384

// Results

385

itkGetConstReferenceMacro(FinalMeans, MeansContainer);

386

387

protected:

388

virtual void GenerateData() ITK_OVERRIDE;

389

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

390

};

391

```

392

393

### ScalarImageKmeansImageFilter

394

395

K-means clustering for scalar images.

396

397

```cpp { .api }

398

template<typename TInputImage, typename TOutputImage>

399

class ScalarImageKmeansImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>

400

{

401

public:

402

typedef ScalarImageKmeansImageFilter Self;

403

typedef ImageToImageFilter<TInputImage, TOutputImage> Superclass;

404

typedef SmartPointer<Self> Pointer;

405

typedef SmartPointer<const Self> ConstPointer;

406

407

static Pointer New();

408

409

// Class means

410

void AddClassWithInitialMean(RealPixelType mean);

411

void SetClassMeans(const MeansContainer & classMeans);

412

itkGetConstReferenceMacro(ClassMeans, MeansContainer);

413

itkGetConstReferenceMacro(FinalMeans, MeansContainer);

414

415

// Use non-contiguous labels

416

void SetUseNonContiguousLabels(bool useNonContiguousLabels);

417

itkGetConstMacro(UseNonContiguousLabels, bool);

418

419

// Image region for sampling

420

itkSetMacro(ImageRegion, ImageRegionType);

421

itkGetConstMacro(ImageRegion, ImageRegionType);

422

423

protected:

424

virtual void GenerateData() ITK_OVERRIDE;

425

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

426

};

427

```

428

429

## Active Contour Methods

430

431

### CurvesLevelSetImageFilter

432

433

Curves evolution level set filter.

434

435

```cpp { .api }

436

template<typename TInputImage, typename TFeatureImage, typename TOutputPixelType>

437

class CurvesLevelSetImageFilter : public SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType>

438

{

439

public:

440

typedef CurvesLevelSetImageFilter Self;

441

typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;

442

typedef SmartPointer<Self> Pointer;

443

typedef SmartPointer<const Self> ConstPointer;

444

445

static Pointer New();

446

447

// Derivative sigma

448

void SetDerivativeSigma(float derivativeSigma);

449

itkGetConstMacro(DerivativeSigma, float);

450

451

protected:

452

virtual void GenerateData() ITK_OVERRIDE;

453

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

454

};

455

```

456

457

### ThresholdSegmentationLevelSetImageFilter

458

459

Threshold-based level set segmentation.

460

461

```cpp { .api }

462

template<typename TInputImage, typename TFeatureImage, typename TOutputPixelType>

463

class ThresholdSegmentationLevelSetImageFilter : public SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType>

464

{

465

public:

466

typedef ThresholdSegmentationLevelSetImageFilter Self;

467

typedef SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, TOutputPixelType> Superclass;

468

typedef SmartPointer<Self> Pointer;

469

typedef SmartPointer<const Self> ConstPointer;

470

471

static Pointer New();

472

473

// Threshold values

474

void SetUpperThreshold(ValueType upperThreshold);

475

void SetLowerThreshold(ValueType lowerThreshold);

476

itkGetConstMacro(UpperThreshold, ValueType);

477

itkGetConstMacro(LowerThreshold, ValueType);

478

479

// Edge weight

480

void SetEdgeWeight(ValueType edgeWeight);

481

itkGetConstMacro(EdgeWeight, ValueType);

482

483

// Smoothing iterations

484

void SetSmoothingIterations(int smoothingIterations);

485

itkGetConstMacro(SmoothingIterations, int);

486

487

// Smoothing time step

488

void SetSmoothingTimeStep(TimeStepType smoothingTimeStep);

489

itkGetConstMacro(SmoothingTimeStep, TimeStepType);

490

491

// Smoothing conductance

492

void SetSmoothingConductance(ValueType smoothingConductance);

493

itkGetConstMacro(SmoothingConductance, ValueType);

494

495

protected:

496

virtual void GenerateData() ITK_OVERRIDE;

497

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

498

};

499

```

500

501

## Voronoi Diagram Based Segmentation

502

503

### VoronoiSegmentationImageFilter

504

505

Voronoi diagram-based segmentation.

506

507

```cpp { .api }

508

template<typename TInputImage, typename TOutputImage, typename TBinaryPriorImage>

509

class VoronoiSegmentationImageFilter : public VoronoiSegmentationImageFilterBase<TInputImage, TOutputImage, TBinaryPriorImage>

510

{

511

public:

512

typedef VoronoiSegmentationImageFilter Self;

513

typedef VoronoiSegmentationImageFilterBase<TInputImage, TOutputImage, TBinaryPriorImage> Superclass;

514

typedef SmartPointer<Self> Pointer;

515

typedef SmartPointer<const Self> ConstPointer;

516

517

static Pointer New();

518

519

// Segmentation parameters

520

void SetMean(double mean);

521

void SetSTD(double std);

522

void SetMeanPercentError(double meanPercentError);

523

void SetSTDPercentError(double stdPercentError);

524

itkGetConstMacro(Mean, double);

525

itkGetConstMacro(STD, double);

526

itkGetConstMacro(MeanPercentError, double);

527

itkGetConstMacro(STDPercentError, double);

528

529

// Take a prior

530

void TakeAPrior(const BinaryObjectImage * aprior);

531

532

// Estimation methods

533

void GetPixelStatisticsFromPrior();

534

void SetMeanAndSTD(double mean, double std);

535

536

protected:

537

virtual bool TestHomogeneity(IndexList & Plist) ITK_OVERRIDE;

538

virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;

539

};

540

```

541

542

## Common Usage Patterns

543

544

### Connected Threshold Segmentation

545

546

```cpp

547

// Define image types

548

typedef itk::Image<short, 3> InputImageType;

549

typedef itk::Image<unsigned char, 3> OutputImageType;

550

551

// Create segmentation filter

552

typedef itk::ConnectedThresholdImageFilter<InputImageType, OutputImageType> ConnectedFilterType;

553

ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();

554

555

// Set input image

556

connectedThreshold->SetInput(inputImage);

557

558

// Set seed point

559

InputImageType::IndexType seed;

560

seed[0] = 150; seed[1] = 100; seed[2] = 50;

561

connectedThreshold->SetSeed(seed);

562

563

// Set threshold values

564

connectedThreshold->SetLower(100);

565

connectedThreshold->SetUpper(200);

566

567

// Set output value

568

connectedThreshold->SetReplaceValue(255);

569

570

// Execute segmentation

571

try {

572

connectedThreshold->Update();

573

OutputImageType::Pointer segmentation = connectedThreshold->GetOutput();

574

} catch (itk::ExceptionObject & error) {

575

std::cerr << "Segmentation failed: " << error << std::endl;

576

}

577

```

578

579

### Level Set Segmentation with Fast Marching Initialization

580

581

```cpp

582

// Fast marching initialization

583

typedef itk::FastMarchingImageFilter<InternalImageType, InternalImageType> FastMarchingFilterType;

584

FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();

585

586

// Set up seed nodes

587

typedef FastMarchingFilterType::NodeContainer NodeContainer;

588

typedef FastMarchingFilterType::NodeType NodeType;

589

NodeContainer::Pointer seeds = NodeContainer::New();

590

591

// Add seed points

592

NodeType node;

593

InternalImageType::IndexType seedPosition;

594

seedPosition[0] = 81; seedPosition[1] = 114; seedPosition[2] = 96;

595

node.SetValue(-5.0);

596

node.SetIndex(seedPosition);

597

seeds->InsertElement(0, node);

598

599

fastMarching->SetTrialPoints(seeds);

600

fastMarching->SetSpeedConstant(1.0);

601

fastMarching->SetOutputSize(inputImage->GetBufferedRegion().GetSize());

602

fastMarching->SetOutputRegion(inputImage->GetBufferedRegion());

603

fastMarching->SetOutputSpacing(inputImage->GetSpacing());

604

fastMarching->SetOutputOrigin(inputImage->GetOrigin());

605

fastMarching->SetOutputDirection(inputImage->GetDirection());

606

607

// Geodesic active contour segmentation

608

typedef itk::GeodesicActiveContourLevelSetImageFilter<InternalImageType, InternalImageType> GeodesicActiveContourFilterType;

609

GeodesicActiveContourFilterType::Pointer geodesicActiveContour = GeodesicActiveContourFilterType::New();

610

611

geodesicActiveContour->SetInput(fastMarching->GetOutput());

612

geodesicActiveContour->SetFeatureImage(gradientMagnitude);

613

geodesicActiveContour->SetPropagationScaling(2.0);

614

geodesicActiveContour->SetCurvatureScaling(1.0);

615

geodesicActiveContour->SetAdvectionScaling(1.0);

616

geodesicActiveContour->SetMaximumRMSError(0.02);

617

geodesicActiveContour->SetNumberOfIterations(800);

618

619

// Execute segmentation

620

geodesicActiveContour->Update();

621

```

622

623

## Type Definitions

624

625

```cpp { .api }

626

// Common segmentation filter instantiations

627

typedef ConnectedThresholdImageFilter<Image<short,2>, Image<unsigned char,2>> ConnectedThreshold2D;

628

typedef ConnectedThresholdImageFilter<Image<short,3>, Image<unsigned char,3>> ConnectedThreshold3D;

629

630

typedef ConfidenceConnectedImageFilter<Image<short,2>, Image<unsigned char,2>> ConfidenceConnected2D;

631

typedef ConfidenceConnectedImageFilter<Image<short,3>, Image<unsigned char,3>> ConfidenceConnected3D;

632

633

typedef FastMarchingImageFilter<Image<float,2>, Image<float,2>> FastMarching2D;

634

typedef FastMarchingImageFilter<Image<float,3>, Image<float,3>> FastMarching3D;

635

636

typedef GeodesicActiveContourLevelSetImageFilter<Image<float,2>, Image<float,2>> GeodesicActiveContour2D;

637

typedef GeodesicActiveContourLevelSetImageFilter<Image<float,3>, Image<float,3>> GeodesicActiveContour3D;

638

639

typedef WatershedImageFilter<Image<float,2>> Watershed2D;

640

typedef WatershedImageFilter<Image<float,3>> Watershed3D;

641

642

// Level set node types

643

typedef LevelSetNode<float, 2> LevelSetNode2D;

644

typedef LevelSetNode<float, 3> LevelSetNode3D;

645

typedef VectorContainer<unsigned int, LevelSetNode2D> NodeContainer2D;

646

typedef VectorContainer<unsigned int, LevelSetNode3D> NodeContainer3D;

647

648

// Connectivity types

649

enum ConnectivityEnumType {

650

FaceConnectivity,

651

FullConnectivity

652

};

653

654

// Label types for watershed

655

typedef unsigned long IdentifierType;

656

typedef Image<IdentifierType, 2> LabelImage2D;

657

typedef Image<IdentifierType, 3> LabelImage3D;

658

```

659

660

ITK's segmentation framework provides a comprehensive suite of algorithms for medical image segmentation, from simple threshold-based methods to advanced level set and active contour techniques.