def __init__(self, domain):
        super(ActiveContourWindow, self).__init__()
        self.setGeometry(300, 300, 650, 650)
        self.setWindowTitle('Active Contour')
        self.domain = domain

        """
        Fetch image and compute statistics
        sensor         = domain.get_radar()
        detect_channel = domain.algorithm_params['water_detect_radar_channel']
        ee_image       = sensor.image.select([detect_channel]).toUint16()
        if sensor.log_scale:
            statisics_image = ee_image.log10()
        else:
            statisics_image = ee_image
        (band_names, band_statistics) = compute_band_statistics(statisics_image, domain.ground_truth, domain.bounds)

        (self.local_image, self.snake) = initialize_active_contour(domain, ee_image, band_statistics, sensor.log_scale)

         Retrieve the local image bands and merge them into a fake RGB image
        channels = [self.local_image.get_image(detect_channel), self.local_image.get_image(detect_channel), self.local_image.get_image(detect_channel)]
        channel_images = [PIL.Image.fromarray(numpy.uint8(c*255/1200)) for c in channels]  Convert from 16 bit to 8 bit
        self.display_image = PIL.Image.merge('RGB', channel_images)
        self.step = 1
        self.show()
        """
        """
        Initialize the contour with the selected sensor band
        sensor_name = 'uavsar'
        sensor      = getattr(domain, sensor_name)
        ee_image    = sensor.image.select(['hh'])

        # TODO: Make sure the name and statistics line up inside the class!
        # Compute statistics for each band -> Log10 needs to be applied here!
        (band_names, band_statistics) = compute_band_statistics(statisics_image, domain.ground_truth, domain.bounds)

        (self.local_image, self.snake) = initialize_active_contour(domain, ee_image, band_statistics, sensor.log_scale)

        # Retrieve the local image bands and merge them into a fake RGB image
        #channels = [self.local_image.get_image('hh'), self.local_image.get_image('hv'), self.local_image.get_image('vv')]
        channels = [self.local_image.get_image('hh'), self.local_image.get_image('hh'), self.local_image.get_image('hh')]
        channel_images = [PIL.Image.fromarray(numpy.uint8(c >> 8)) for c in channels] # Convert from 16 bit to 8 bit
        self.display_image = PIL.Image.merge('RGB', channel_images)
        self.step = 1
        self.show()
        """

        SKYBOX_SCALE = 1200 / 256
        train_domain = domain.training_domain  # For skybox data there is probably no earlier image to train off of
        try:  # The Skybox data can be in one of two names
            sensor = domain.skybox
            trainSensor = train_domain.skybox
        except:
            sensor = domain.skybox_nir
            trainSensor = train_domain.skybox_nir
        ee_image = sensor.image.toUint16()  # For Skybox, these are almost certainly the same image.
        ee_image_train = trainSensor.image.toUint16()

        if train_domain.training_features:  # Train using features
            (band_names, band_statistics) = compute_band_statistics_features(ee_image_train, train_domain.training_features)
        else: # Train using training truth
            (band_names, band_statistics) = compute_band_statistics(ee_image_train, train_domain.ground_truth,
                                                                    train_domain.bounds)
        (self.local_image, self.snake) = initialize_active_contour(domain, ee_image, band_statistics, False)

        # Retrieve the local image bands and merge them into a fake RGB image
        channels = [self.local_image.get_image('Red'), self.local_image.get_image('Green'), self.local_image.get_image('Blue')]
        channel_images = [PIL.Image.fromarray(numpy.uint8(c / SKYBOX_SCALE)) for c in channels] # Convert from Skybox range to 8 bit
        self.display_image = PIL.Image.merge('RGB', channel_images)
        self.step = 1
        self.show()
dataset/ETHPy150Open nasa/CrisisMappingToolkit/bin/test_active_contour.py/ActiveContourWindow.__init__/original