<s> import itk <EOL> import core . modules <EOL> from core . modules . vistrails_module import Module , ModuleError <EOL> from ITK import * <EOL> from Image import Image <EOL> class IsolatedWatershedImageFilter ( Module ) : <EOL> my_namespace = "<STR_LIT>" <EOL> def compute ( self ) : <EOL> im = self . get_input ( "<STR_LIT>" ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> inPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> inPixelType = im . getPixelType ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> outPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> outPixelType = inPixelType <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> dim = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> dim = im . getDim ( ) <EOL> inImgType = itk . Image [ inPixelType . _type , dim ] <EOL> outImgType = itk . Image [ outPixelType . _type , dim ] <EOL> self . filter_ = itk . IsolatedWatershedImageFilter [ inImgType , outImgType ] . New ( im . getImg ( ) ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> self . filter_ . SetSeed1 ( self . get_input ( "<STR_LIT>" ) . ind_ ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> self . filter_ . SetSeed2 ( self . get_input ( "<STR_LIT>" ) . ind_ ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> self . filter_ . SetReplaceValue1 ( self . get_input ( "<STR_LIT>" ) ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> self . filter_ . SetReplaceValue2 ( self . get_input ( "<STR_LIT>" ) ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> self . filter_ . SetThreshold ( self . get_input ( "<STR_LIT>" ) ) <EOL> self . filter_ . Update ( ) <EOL> outIm = Image ( ) <EOL> outIm . setImg ( self . filter_ . GetOutput ( ) ) <EOL> outIm . setPixelType ( outPixelType ) <EOL> outIm . setDim ( dim ) <EOL> self . set_output ( "<STR_LIT>" , outIm ) <EOL> self . set_output ( "<STR_LIT>" , outPixelType ) <EOL> self . set_output ( "<STR_LIT>" , self ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , name = "<STR_LIT>" , namespace = cls . my_namespace ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) ; <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) ; <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) ) <EOL> class ConnectedThresholdImageFilter ( Module ) : <EOL> my_namespace = "<STR_LIT>" <EOL> def compute ( self ) : <EOL> im = self . get_input ( "<STR_LIT>" ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> inPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> inPixelType = im . getPixelType ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> outPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> outPixelType = inPixelType <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> dim = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> dim = im . getDim ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> seed = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> seed = self . get_input ( "<STR_LIT>" ) <EOL> replace = self . get_input ( "<STR_LIT>" ) <EOL> t_lower = self . get_input ( "<STR_LIT>" ) <EOL> t_upper = self . get_input ( "<STR_LIT>" ) <EOL> inImgType = itk . Image [ inPixelType . _type , dim ] <EOL> outImgType = itk . Image [ outPixelType . _type , dim ] <EOL> self . filter_ = itk . ConnectedThresholdImageFilter [ inImgType , outImgType ] . New ( im . getImg ( ) ) <EOL> self . filter_ . SetSeed ( seed . ind_ ) <EOL> self . filter_ . SetReplaceValue ( replace ) <EOL> self . filter_ . SetLower ( t_lower ) <EOL> self . filter_ . SetUpper ( t_upper ) <EOL> self . filter_ . Update ( ) <EOL> outIm = Image ( ) <EOL> outIm . setImg ( self . filter_ . GetOutput ( ) ) <EOL> outIm . setPixelType ( outPixelType ) <EOL> outIm . setDim ( dim ) <EOL> self . set_output ( "<STR_LIT>" , outIm ) <EOL> self . set_output ( "<STR_LIT>" , outPixelType ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , name = "<STR_LIT>" , namespace = cls . my_namespace ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index3D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) ) <EOL> class ConfidenceConnectedImageFilter ( Module ) : <EOL> my_namespace = "<STR_LIT>" <EOL> def compute ( self ) : <EOL> im = self . get_input ( "<STR_LIT>" ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> inPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> inPixelType = im . getPixelType ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> outPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> outPixelType = inPixelType <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> dim = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> dim = im . getDim ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> seed = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> seed = self . get_input ( "<STR_LIT>" ) <EOL> replace = self . get_input ( "<STR_LIT>" ) <EOL> multiplier = self . get_input ( "<STR_LIT>" ) <EOL> iterations = self . get_input ( "<STR_LIT>" ) <EOL> radius = self . get_input ( "<STR_LIT>" ) <EOL> inImgType = itk . Image [ inPixelType . _type , dim ] <EOL> outImgType = itk . Image [ outPixelType . _type , dim ] <EOL> self . filter_ = itk . ConfidenceConnectedImageFilter [ inImgType , outImgType ] . New ( im . getImg ( ) ) <EOL> self . filter_ . SetReplaceValue ( replace ) <EOL> self . filter_ . SetMultiplier ( multiplier ) <EOL> self . filter_ . SetNumberOfIterations ( iterations ) <EOL> self . filter_ . SetInitialNeighborhoodRadius ( radius ) <EOL> self . filter_ . SetSeed ( seed . ind_ ) <EOL> self . filter_ . Update ( ) <EOL> outIm = Image ( ) <EOL> outIm . setImg ( self . filter_ . GetOutput ( ) ) <EOL> outIm . setPixelType ( outPixelType ) <EOL> outIm . setDim ( dim ) <EOL> self . set_output ( "<STR_LIT>" , outIm ) <EOL> self . set_output ( "<STR_LIT>" , outPixelType ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , name = "<STR_LIT>" , namespace = cls . my_namespace ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index3D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) ) <EOL> class IsolatedConnectedImageFilter ( Module ) : <EOL> my_namespace = "<STR_LIT>" <EOL> def compute ( self ) : <EOL> im = self . get_input ( "<STR_LIT>" ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> inPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> inPixelType = im . getPixelType ( ) <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> outPixelType = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> outPixelType = inPixelType <EOL> if self . has_input ( "<STR_LIT>" ) : <EOL> dim = self . get_input ( "<STR_LIT>" ) <EOL> else : <EOL> dim = im . getDim ( ) <EOL> seed1 = self . get_input ( "<STR_LIT>" ) <EOL> seed2 = self . get_input ( "<STR_LIT>" ) <EOL> replace = self . get_input ( "<STR_LIT>" ) <EOL> t_lower = self . get_input ( "<STR_LIT>" ) <EOL> t_upper = self . get_input ( "<STR_LIT>" ) <EOL> inImgType = itk . Image [ inPixelType . _type , dim ] <EOL> outImgType = itk . Image [ outPixelType . _type , dim ] <EOL> self . filter_ = itk . IsolatedConnectedImageFilter [ inImgType , outImgType ] . New ( im . getImg ( ) ) <EOL> self . filter_ . SetReplaceValue ( replace ) <EOL> self . filter_ . SetLower ( t_lower ) <EOL> self . filter_ . SetUpperValueLimit ( t_upper ) <EOL> self . filter_ . SetSeed1 ( seed1 . ind_ ) <EOL> self . filter_ . SetSeed2 ( seed2 . ind_ ) <EOL> self . filter_ . Update ( ) <EOL> outIm = Image ( ) <EOL> outIm . setImg ( self . filter_ . GetOutput ( ) ) <EOL> outIm . setPixelType ( outPixelType ) <EOL> outIm . setDim ( dim ) <EOL> self . set_output ( "<STR_LIT>" , outIm ) <EOL> self . set_output ( "<STR_LIT>" , outPixelType ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , name = "<STR_LIT>" , namespace = cls . my_namespace ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( Index2D , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( Image , '<STR_LIT>' ) ) <EOL> reg . add_output_port ( cls , "<STR_LIT>" , ( PixelType , '<STR_LIT>' ) ) </s>
