Error: DICOMSegmentationPlugin is not defined

Yes for that example to work you have to have a Slicer extension installed. See the following thread about this: