def test_SegSizeAndRegionHandlers(self):
        # get the segsize and the region from the files
        region = segmentizer.getRegion()
        segsize = segmentizer.getSegSize()

        # should be tuples of appropiate length
        self.assertEqual(len(region), 4, "region contains to much items (should be 4)")
        self.assertEqual(len(segsize), 2, "segsize contains to much items (should be 2)")

        # save the segsize and the region to the files
        segmentizer.setRegion(region)
        segmentizer.setSegSize(segsize)

        # check if they are saved correct
        savedRegion = segmentizer.getRegion()
        savedSegsize = segmentizer.getSegSize()

        self.assertEqual(region, savedRegion, "Region is not saved correct.")
        self.assertEqual(segsize, savedSegsize, "segsize is not saved correct.")
    def test_segmentize(self):
        self.segmentizer.setSegmentSize(segmentizer.getSegSize())
        self.segmentizer.setRegionOfInterest(segmentizer.getRegion())
        segments = self.segmentizer.getSegments(self.image)

        # check if segments are set
        segSize = self.segmentizer.segmentSize
        region = self.segmentizer.regionOfInterest

        self.assertEqual(len(segments), math.ceil(float(region[3])/segSize[1]), "Segmentation problem. Incorrect number of rows")
        self.assertEqual(len(segments[0]), math.ceil(float(region[2])/segSize[0]), "Segmentation problem. Incorrect number of columns")
    def test_SegSizeAndRegionHandlers(self):
        # get the segsize and the region from the files
        region = segmentizer.getRegion()
        segsize = segmentizer.getSegSize()

        # should be tuples of appropiate length
        self.assertEqual(len(region), 4,
                         "region contains to much items (should be 4)")
        self.assertEqual(len(segsize), 2,
                         "segsize contains to much items (should be 2)")

        # save the segsize and the region to the files
        segmentizer.setRegion(region)
        segmentizer.setSegSize(segsize)

        # check if they are saved correct
        savedRegion = segmentizer.getRegion()
        savedSegsize = segmentizer.getSegSize()

        self.assertEqual(region, savedRegion, "Region is not saved correct.")
        self.assertEqual(segsize, savedSegsize,
                         "segsize is not saved correct.")
    def test_segmentize(self):
        self.segmentizer.setSegmentSize(segmentizer.getSegSize())
        self.segmentizer.setRegionOfInterest(segmentizer.getRegion())
        segments = self.segmentizer.getSegments(self.image)

        # check if segments are set
        segSize = self.segmentizer.segmentSize
        region = self.segmentizer.regionOfInterest

        self.assertEqual(len(segments),
                         math.ceil(float(region[3]) / segSize[1]),
                         "Segmentation problem. Incorrect number of rows")
        self.assertEqual(len(segments[0]),
                         math.ceil(float(region[2]) / segSize[0]),
                         "Segmentation problem. Incorrect number of columns")