Exemple #1
0
 def __init__(self, path):
     self.path = path
     self.config_file = ConfigMaker(self.path)
     self.hsv_jpg_file = ""
     self.mask_png_file = ""
     self.seed_labels_jpg_file = ""
     self.imposed_annotation_jpg_file = ""
     self.original_image_jpg_file = ""
     self.html_file = HtmlMaker(self.path)
     self.image_name = ""
     self.csv_string = ""
     # imagename,NumberofPeas,MeanAreaPixels,EqdMeanPixels,meanperimeterPixels
     self.numberofseeds = 0
     self.area_sum = 0
     self.area_mean = 0
     self.eqd_sum = 0
     self.eqd_mean = 0
     self.perimeter_sum = 0
     self.perimeter_mean = 0
     self.sum_max_mins = 0
     self.mean_max_mins = 0
     self.csv_file = Parameters.results + "/tables/workfile.csv"
     self.accession_workfile = ""
     self.csv_string_list = []
     self.pixels_per_cm = 0.0
Exemple #2
0
class seed:
    def __init__(self, path):
        self.path = path
        self.config_file = ConfigMaker(self.path)
        self.hsv_jpg_file = ""
        self.mask_png_file = ""
        self.seed_labels_jpg_file = ""
        self.imposed_annotation_jpg_file = ""
        self.original_image_jpg_file = ""
        self.html_file = HtmlMaker(self.path)
        self.image_name = ""
        self.csv_string = ""
        # imagename,NumberofPeas,MeanAreaPixels,EqdMeanPixels,meanperimeterPixels
        self.numberofseeds = 0
        self.area_sum = 0
        self.area_mean = 0
        self.eqd_sum = 0
        self.eqd_mean = 0
        self.perimeter_sum = 0
        self.perimeter_mean = 0
        self.sum_max_mins = 0
        self.mean_max_mins = 0
        self.csv_file = Parameters.results + "/tables/workfile.csv"
        self.accession_workfile = ""
        self.csv_string_list = []
        self.pixels_per_cm = 0.0

    def seed_analyse(self):
        self.extract_image_ruler()
        self.pixels_per_cm = self.image_ruler.pixels_per_cm
        image_path_list = self.path.split("/")
        self.image_name = image_path_list[-1]
        self.csv_string = self.image_name + "\t"
        self.accession_workfile = Parameters.results + "/tables/" + self.image_name + "_workfile.csv"

        img = cv2.imread(self.path)

        # figure(figsize=(15,15))
        hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
        print "Making hsv image."
        self.hsv_jpg_file = Parameters.results + "/images/" + self.image_name + "_hsv.jpg"
        cv2.imwrite(self.hsv_jpg_file, hsv)
        self.config_file.hsv_output_config_file(self.hsv_jpg_file)
        upper_green = np.array([35, 255, 255])
        lower_green = np.array([10, 100, 20])
        mask = cv2.inRange(hsv, lower_green, upper_green)

        res = cv2.bitwise_and(hsv, hsv, mask=mask)

        mask = cv2.bilateralFilter(mask, 15, 75, 75)
        print "Applying green mask_png_file."
        self.mask_png_file = Parameters.results + "/images/" + self.image_name + "_imagemask.png"
        cv2.imwrite(self.mask_png_file, mask)
        self.config_file.mask_output_config_file(self.mask_png_file)

        labels = skimg.measure.label(mask)
        len(labels)
        print "Creating labels for seeds."
        self.seed_labels_jpg_file = Parameters.results + "/images/" + self.image_name + "_labels.png"
        cv2.imwrite(self.seed_labels_jpg_file, labels)
        self.config_file.seed_labels_output_config_file(
            self.seed_labels_jpg_file)

        properties = skimg.measure.regionprops(labels)
        print len(properties)
        print "Showing original image."
        self.original_image_jpg_file = Parameters.results + "/images/" + self.image_name + "_img.png"
        cv2.imwrite(self.original_image_jpg_file, img)
        plt.figure(figsize=(10, 10))
        plt.imshow(img)
        self.config_file.original_image_jpg_output_config_file(
            self.original_image_jpg_file)
        clean_obj = []
        clean_obj_contours = [
        ]  #not used, but gives the contour for each of the seeds and could be useful later.
        max_mins_list = []
        eccentricity_list = []
        eccentricity_sum = 0.0
        counter = 0
        sum_max_min = 0
        im = Image.open(self.path)
        draw = ImageDraw.Draw(im)

        for p in properties:
            if p.area > 1000:
                if p.perimeter / p.equivalent_diameter < 5 and p.perimeter / p.equivalent_diameter > 3:
                    eccentricity_list.append(p.eccentricity)
                    eccentricity_sum += p.eccentricity
                    plt.annotate("%d" % (p.area, ),
                                 xy=(p.centroid[1], p.centroid[0]))
                    plt.plot(p.centroid[1], p.centroid[0], 'o')
                    clean_obj.append(p)
                    reference_image = io.imread(self.path)
                    pea_hsv = color.rgb2hsv(reference_image)
                    pea_hue = pea_hsv[:, :, 0]
                    blank_img = np.zeros((pea_hue.shape[0], pea_hue.shape[1]),
                                         dtype=np.uint8)
                    leaf_tmp = blank_img.copy()  # also another array of zeros
                    ###########################################
                    #TESTING - ADDING CONTOURS
                    ref_coord = p.coords.astype(int)
                    for count, value in enumerate(p.coords):
                        leaf_tmp[value[0]][value[1]] = 255
                    #leaf_tmp[ref_coord[:, 0], ref_coord[:, 1]] = 255
                    tmp_path = Parameters.tmp_dir + "/" + self.image_name + ".__" + str(
                        counter) + ".jpg"
                    io.imsave(tmp_path, leaf_tmp)
                    counter += 1
                    contours = skimg.measure.find_contours(
                        leaf_tmp, 0.8, fully_connected='high')
                    contours.sort(lambda x, y: cmp(len(x), len(y)))
                    #print "AREA: ", p.area
                    #for n, contour in enumerate(contours):
                    #    print "length Contour: ", len(contour)
                    #if len(contour) > 200:
                    contour = contours[-1]
                    clean_obj_contours.append(contour)
                    #print "length Contour: ", len(contour)
                    distances = []
                    for m, point in enumerate(contour):
                        tuple = (int(point[1]), int(point[0]))
                        im.putpixel(tuple, (0, 255, 0, 255))
                        distance = math.sqrt(
                            math.pow(tuple[0] - p.centroid[0], 2) +
                            math.pow(tuple[1] - p.centroid[1], 2))
                        distances.append(distance)
                    #maximums = seed.get_maximum_points_on_contour(distances, 10)
                    #minimus = seed.get_minimum_points_on_contour(distances, 10)
                    position = []
                    for i, value in enumerate(contour):
                        position.append(i)
                    yhat = savgol_filter(
                        distances, 67, 8,
                        mode="nearest")  # window size 51, polynomial order 3
                    maximums = signal.argrelmax(np.asarray(yhat))
                    minimums = signal.argrelmin(np.asarray(yhat))
                    max_min = (len(maximums) + len(minimums))
                    sum_max_min += max_min
                    max_mins_list.append(max_min)
                    #print "len max: ", len(maximums)
                    #print "len max: ", len(minimums)
                    plt.figure(num=None,
                               figsize=(18, 18),
                               dpi=80,
                               facecolor='w',
                               edgecolor='k')
                    plt.subplot(211)
                    plt.plot(position, distances, 'y-')
                    plt.plot(position, yhat, 'g-')
                    plt.xlabel("position on contour")
                    plt.ylabel("distance from centroid")
                    plt.title("pea contour plot")
                    for m, value in enumerate(maximums[0]):
                        #print "value:",value
                        plt.plot(position[value], distances[value], 'ro')
                        x = int(contour[value][1])
                        y = int(contour[value][0])
                        r = 2
                        #im.putpixel(max, (0, 0, 255, 255))
                        draw.ellipse((x - r, y - r, x + r, y + r),
                                     fill=(255, 0, 0, 255))
                    for m, value in enumerate(minimums[0]):
                        #print "value: ", value
                        plt.plot(position[value], distances[value], 'bo')
                        x = int(contour[value][1])
                        y = int(contour[value][0])
                        r = 2
                        #im.putpixel(max, (0, 0, 255, 255))
                        draw.ellipse((x - r, y - r, x + r, y + r),
                                     fill=(0, 0, 255, 255))
                    plt.savefig(Parameters.tmp_dir + "/" + self.image_name +
                                ".pea_plot." + str(counter) + ".png",
                                bbox_inches='tight')
                    draw.ellipse((p.centroid[1] - r, p.centroid[0] - r,
                                  p.centroid[1] + r, p.centroid[0] + r),
                                 fill=(255, 0, 0, 255))

        if counter == 0:
            return self.image_name + ",empty,,,,,,,,,\n"
        self.mean_max_mins = sum_max_min / counter
        im.save(Parameters.tmp_dir + "/" + self.image_name +
                ".with_contours.jpg")
        plt.xlim((0, img.shape[1]))
        plt.ylim((img.shape[0], 0))
        print "Imposing annotation onto image."
        self.imposed_annotation_jpg_file = Parameters.results + "/images/" + self.image_name + "_imposed.png"
        plt.savefig(self.imposed_annotation_jpg_file, bbox_inches=None)
        self.config_file.imposed_annotation_output_config_file(
            self.imposed_annotation_jpg_file)
        # Descriptive stats
        self.numberofseeds = str(len(clean_obj))

        # print "Number of peas found: \t%d" %(len(clean_obj), )
        # print "Mean pea size: \t\t%.2f" %(np.array([p.area for p in clean_obj]).mean(), )
        # print "Sd for mean pea size: \t%.2f" %(np.array([p.area for p in clean_obj]).std(), )
        #
        # print "The median is %f" % (np.median(np.array([p.area for p in clean_obj])))
        # print "The maximum is %f" % (np.max(np.array([p.area for p in clean_obj])))
        # print "The minimum is %f" % (np.min(np.array([p.area for p in clean_obj])))
        # draw violin plot
        rep_area = [p.area for p in clean_obj]
        rep_eqd = [p.equivalent_diameter for p in clean_obj]
        rep_perimeter = [p.perimeter for p in clean_obj]
        rep_centroid = [p.centroid for p in clean_obj]
        #####
        self.html_file.accession_area_pixel_maker(rep_area, self.image_name)
        self.html_file.accession_eqd_pixel_maker(rep_eqd, self.image_name)
        self.html_file.accession_perimeter_pixel_maker(rep_perimeter,
                                                       self.image_name)
        #####################
        # Create averages for each
        #####################
        for i in rep_area:
            self.area_sum = float(self.area_sum) + float(i)
        self.area_mean = self.area_sum / float(self.numberofseeds)
        self.area_mean = str(self.area_mean)

        for i in rep_eqd:
            self.eqd_sum = float(self.eqd_sum) + float(i)
        self.eqd_mean = self.eqd_sum / float(self.numberofseeds)
        self.eqd_mean = str(self.eqd_mean)

        for i in rep_perimeter:
            self.perimeter_sum = float(self.perimeter_sum) + float(i)
        self.perimeter_mean = self.perimeter_sum / float(self.numberofseeds)
        self.perimeter_mean = str(self.perimeter_mean)
        #####################
        # create a table (1 accession, all seeds)
        #####################
        workfile = open(self.accession_workfile, "w")

        workfile.write(
            "Perimeter,Area,Equivalent Diameter,max_mins, eccentricity\n")
        for i in range(len(clean_obj)):
            seed_string = str(rep_perimeter[i]) + "," + str(
                rep_area[i]) + "," + str(rep_eqd[i]) + "," + str(
                    max_mins_list[i]) + "," + str(eccentricity_list[i])
            workfile.write(seed_string)
            workfile.write("\n")
        workfile.close()
        df = pd.read_csv(self.accession_workfile, sep=",")
        df.index = np.arange(1, len(df) + 1)
        seed_table = df.to_html(justify='left')
        list_seed_table = seed_table.split('\n')
        del list_seed_table[0]
        del list_seed_table[-1]
        seed_table = "\n".join(list_seed_table)

        self.html_file.accession_seed_table_file_maker(seed_table,
                                                       self.image_name)

        self.html_file.accession_method_html_maker(
            self.original_image_jpg_file, self.hsv_jpg_file,
            self.mask_png_file, self.seed_labels_jpg_file,
            self.imposed_annotation_jpg_file, self.image_name)
        print "Printing csv string for this accession: ", self.image_name

        one_over_pix_per_cm = float(1.0 / float(self.pixels_per_cm))
        area_mean_cm = float(
            self.area_mean) * one_over_pix_per_cm * one_over_pix_per_cm
        eqd_mean_cm = float(self.eqd_mean) / float(self.pixels_per_cm)
        perimeter_mean_cm = float(self.perimeter_mean) / float(
            self.pixels_per_cm)
        ecc_mean = float(eccentricity_sum) / counter
        self.csv_string = self.image_name + "," + \
                          self.numberofseeds + "," + \
                          self.area_mean + "," + \
                          self.eqd_mean + "," + \
                          self.perimeter_mean + "," + \
                          str(self.mean_max_mins) + "," + \
                          str(self.pixels_per_cm) + "," + \
                          str(area_mean_cm) + "," + \
                          str(eqd_mean_cm) + "," + \
                          str(perimeter_mean_cm) + "," + \
                          str(ecc_mean) + "\n"
        return self.csv_string

    def extract_image_ruler(self):
        print "extract_image_ruler: ", self.path
        reference_image = io.imread(self.path)
        resized_image_ruler = rescale(reference_image, 0.5,
                                      mode='constant')  # 50% more pixels
        image_path_list = self.path.split("/")
        image_name = image_path_list[-1]
        dst = Parameters.tmp_dir + "/" + image_name
        io.imsave(dst, resized_image_ruler)
        self.image_ruler = RulerMeasure(dst, self.config_file)
        # add success for this process to the config
        #self.config_file.resizedforruler_output_config_file(self.path + ".resizedforruler.jpg")
        self.image_ruler.process_ruler()
Exemple #3
0
 def __init__(self):
     self.config_file = ConfigMaker(Parameters.results +
                                    "/summary_output.config")
Exemple #4
0
class HtmlMaker:
    def __init__(self, config):
        self.images = []
        self.config_file = ConfigMaker(Parameters.results +
                                       "/summary_output.config")

    def make_html(self, out_dir, images):
        """ Making SUMMARY Table """
        # open tsv file
        f_tsv = open(Parameters.results + '/tables/workfile.tsv', "r")
        # make new html
        f = open(Parameters.results + "/html/html_summary_table.html", 'w')
        # read tsv as thml
        tsv_data_to_html = pd.read_table(f_tsv, "\t")
        html_table = tsv_data_to_html.to_html()

        my_html_table_list = html_table.split("\n")

        # substitute lines in table
        table_index = my_html_table_list.index(
            "<table border=\"1\" class=\"dataframe\">")
        my_html_table_list[
            table_index] = "<table class=\"table table-striped results\">"

        header_string = "<tr style=\"text-align: right;\">"
        sub_str = [s for s in my_html_table_list if header_string in s]
        new_sub_str = str(sub_str[0])
        table_index = my_html_table_list.index(new_sub_str)
        my_html_table_list[table_index] = "<tr style=\"text-align: left;\">"

        header_string = "<th>Area_cm2</th>"
        sub_str = [s for s in my_html_table_list if header_string in s]
        new_sub_str = str(sub_str[0])
        table_index = my_html_table_list.index(new_sub_str)
        my_html_table_list[table_index] = "<th>Area cm<sup>2</sup></th>"

        header_string = "<th>Length_cm</th>"
        sub_str = [s for s in my_html_table_list if header_string in s]
        new_sub_str = str(sub_str[0])
        table_index = my_html_table_list.index(new_sub_str)
        my_html_table_list[table_index] = "<th>Length cm</th>"

        header_string = "<th>Width_cm</th>"
        sub_str = [s for s in my_html_table_list if header_string in s]
        new_sub_str = str(sub_str[0])
        table_index = my_html_table_list.index(new_sub_str)
        my_html_table_list[table_index] = "<th>Width cm</th>"

        header_string = "<th>Perimeter_cm</th>"
        sub_str = [s for s in my_html_table_list if header_string in s]
        new_sub_str = str(sub_str[0])
        table_index = my_html_table_list.index(new_sub_str)
        my_html_table_list[table_index] = "<th>Perimeter cm</th>"

        joined_table = '\n'.join(my_html_table_list)

        # open index html
        # my_html_test_doc = []
        f2 = open("../resources/html/index_summary.html", "r")
        my_html_test_doc = f2.read().split('\n')
        # substitute lines in html doc
        html_index = my_html_test_doc.index("THIS IS TABLE")
        my_html_test_doc[html_index] = joined_table

        html_index = my_html_test_doc.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc[html_index] = bootstrap_string

        html_index = my_html_test_doc.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc)
        f.write(str_for_html)

        # close
        f.close()
        f2.close()
        # f_tsv.close()
        # open
        filename = 'file://' + Parameters.results + "/html/html_summary_table.html"

        # add success for this process to the config
        self.config_file.html_summary_output_config_file(
            Parameters.results + "/html/html_summary_table.html")
        """ Making Summary Plots Pixels """
        # TODO: MAKE PATHS RELEATIVE!!!!!!
        f_plot_pixel = open(
            Parameters.results +
            '/html/html_summary_plot_pixels_morphological.html', 'w')
        my_html_test_doc_plot_pixels = []
        f1_p = open(
            '../resources/html/index_plot_leaf_morphological_pixels.html', "r")
        my_html_test_doc_plot_pixels = f1_p.read().split('\n')
        # print tsv_data_to_html
        # violin plot data entry PIXELS
        # length
        length = tsv_data_to_html["Length"].tolist()
        string_length_array = "var x14=[length]"
        html_index = my_html_test_doc_plot_pixels.index(string_length_array)
        my_html_test_doc_plot_pixels[html_index] = "var x14=%s" % length
        #####################
        print "Adding length pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Major axis length (length) in Pixels")
        plt.boxplot(length, 0, 'rs', 0)
        boxplot_path_length_pixels = Parameters.results + "/images/plot_length_pixels.png"
        savefig(boxplot_path_length_pixels)
        self.config_file.length_pixels_boxplot_output_config_file(
            boxplot_path_length_pixels)
        #####################
        # width
        width = tsv_data_to_html["Width"].tolist()
        string_width_array = "var x13=[width]"
        html_index = my_html_test_doc_plot_pixels.index(string_width_array)
        my_html_test_doc_plot_pixels[html_index] = "var x13=%s" % width
        #####################
        print "Adding width pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Minor axis length (width) in Pixels")
        plt.boxplot(width, 0, 'rs', 0)
        boxplot_path_width_pixels = Parameters.results + "/images/plot_width_pixels.png"
        savefig(boxplot_path_width_pixels)
        self.config_file.width_pixels_boxplot_output_config_file(
            boxplot_path_width_pixels)

        #####################
        # area
        area = tsv_data_to_html["Area"].tolist()
        string_area_array = "var x12=[area]"
        html_index = my_html_test_doc_plot_pixels.index(string_area_array)
        my_html_test_doc_plot_pixels[html_index] = "var x12=%s" % area
        #####################
        print "Adding area pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Area in Pixels")
        plt.boxplot(area, 0, 'rs', 0)
        boxplot_path_area_pixels = Parameters.results + "/images/plot_area_pixels.png"
        savefig(boxplot_path_area_pixels)
        self.config_file.area_pixels_boxplot_output_config_file(
            boxplot_path_area_pixels)

        #####################
        # perimeter
        perimeter = tsv_data_to_html["Perimeter"].tolist()
        string_perimeter_array = "var x11=[perimeter]"
        html_index = my_html_test_doc_plot_pixels.index(string_perimeter_array)
        my_html_test_doc_plot_pixels[html_index] = "var x11=%s" % perimeter
        #####################
        print "Adding perimeter pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter in Pixels")
        plt.boxplot(perimeter, 0, 'rs', 0)
        boxplot_path_perimeter_pixels = Parameters.results + "/images/plot_perimeter_pixels.png"
        savefig(boxplot_path_perimeter_pixels)
        self.config_file.perimeter_pixels_boxplot_output_config_file(
            boxplot_path_perimeter_pixels)

        #####################
        html_index = my_html_test_doc_plot_pixels.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_pixels[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_pixels.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_pixels[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_pixels)
        f_plot_pixel.write(str_for_html)
        f_plot_pixel.close()
        f1_p.close()
        filename_plot = 'file://' + Parameters.results + '/html/html_summary_plot_pixels_morphological.html'

        # add success for this process to the config
        self.config_file.html_plot_pixels_morphological_output_config_file(
            Parameters.results +
            '/html/html_summary_plot_pixels_morphological.html')

        f_plot_pixel = open(
            Parameters.results + '/html/html_summary_plot_pixels_eqs.html',
            'w')
        my_html_test_doc_plot_pixels = []
        f2_p = open('../resources/html/index_plot_leaf_eq_pixels.html', "r")
        my_html_test_doc_plot_pixels = f2_p.read().split('\n')

        equivalent_diameter = tsv_data_to_html["Equivalent Diameter"].tolist()
        string_equivalentdiameter_array = "var x9=[equivalentdiameter]"
        html_index = my_html_test_doc_plot_pixels.index(
            string_equivalentdiameter_array)
        my_html_test_doc_plot_pixels[
            html_index] = "var x9=%s" % equivalent_diameter

        html_index = my_html_test_doc_plot_pixels.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_pixels[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_pixels.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_pixels[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_pixels)
        f_plot_pixel.write(str_for_html)
        f_plot_pixel.close()
        f2.close()
        filename_plot = 'file://' + Parameters.results + '/html/html_summary_plot_pixels_eqs.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_pixels_eqs_output_config_file(
            Parameters.results + '/html/html_summary_plot_pixels_eqs.html')
        #####################
        print "Adding equivalent diameter pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Equivalent Diameter in Pixels")
        plt.boxplot(equivalent_diameter, 0, 'rs', 0)
        boxplot_path_eqd_pixels = Parameters.results + "/images/plot_eqd_pixels.png"
        savefig(boxplot_path_eqd_pixels)
        self.config_file.perimeter_pixels_boxplot_output_config_file(
            boxplot_path_eqd_pixels)

        #####################
        """ Making Summary plot CM """
        ###########
        # CM PLOTS
        f_plot_leaf_morphological_cm = open(
            Parameters.results +
            '/html/html_summary_plot_leaf_morphological_cm.html', 'w')
        f3 = open('../resources/html/index_plot_leaf_morphological_cm.html',
                  "r")
        my_html_test_doc_plot_cm = f3.read().split('\n')
        # violin plot data entry CM
        # length
        length_cm = tsv_data_to_html["Length_cm"].tolist()
        string_length_array = "var x14=[length]"
        html_index = my_html_test_doc_plot_cm.index(string_length_array)
        my_html_test_doc_plot_cm[html_index] = "var x14=%s" % length_cm
        #####################
        print "Adding length cm boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Major Axis Length (length) in Centimeters")
        plt.boxplot(length_cm, 0, 'rs', 0)
        boxplot_path_length_cm = Parameters.results + "/images/plot_length_cm.png"
        savefig(boxplot_path_length_cm)
        self.config_file.length_cm_boxplot_output_config_file(
            boxplot_path_length_cm)

        #####################
        # width
        width_cm = tsv_data_to_html["Width_cm"].tolist()
        string_width_array = "var x13=[width]"
        html_index = my_html_test_doc_plot_cm.index(string_width_array)
        my_html_test_doc_plot_cm[html_index] = "var x13=%s" % width_cm
        #####################
        print "Adding width cm boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Minor Axis Length (Width) in Centimeters")
        plt.boxplot(width_cm, 0, 'rs', 0)
        boxplot_path_width_cm = Parameters.results + "/images/plot_width_cm.png"
        savefig(boxplot_path_width_cm)
        self.config_file.width_cm_boxplot_output_config_file(
            boxplot_path_width_cm)

        #####################
        # area
        area_cm = tsv_data_to_html["Area_cm2"].tolist()
        string_area_array = "var x12=[area]"
        html_index = my_html_test_doc_plot_cm.index(string_area_array)
        my_html_test_doc_plot_cm[html_index] = "var x12=%s" % area_cm
        #####################
        print "Adding area cm boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Area in Centimeters")
        plt.boxplot(area_cm, 0, 'rs', 0)
        boxplot_path_area_cm = Parameters.results + "/images/plot_area_cm.png"
        savefig(boxplot_path_area_cm)
        self.config_file.area_cm_boxplot_output_config_file(
            boxplot_path_area_cm)

        #####################
        # perimeter
        perimeter_cm = tsv_data_to_html["Perimeter_cm"].tolist()
        string_perimeter_array = "var x11=[perimeter]"
        html_index = my_html_test_doc_plot_cm.index(string_perimeter_array)
        my_html_test_doc_plot_cm[html_index] = "var x11=%s" % perimeter_cm
        #####################
        print "Adding perimeter cm boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter in Centimeters")
        plt.boxplot(perimeter_cm, 0, 'rs', 0)
        boxplot_path_perimeter_cm = Parameters.results + "/images/plot_perimeter_cm.png"
        savefig(boxplot_path_perimeter_cm)
        self.config_file.perimeter_cm_boxplot_output_config_file(
            boxplot_path_perimeter_cm)

        #####################
        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_morphological_cm.write(str_for_html)
        f_plot_leaf_morphological_cm.close()
        f3.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_morphological_cm.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_morphological_cm_output_config_file(
            Parameters.results +
            '/html/html_summary_plot_leaf_morphological_cm.html')

        # TODO: make pixel morphological and eqd
        # TODO: add label to the end of this all files
        ##############################
        f_plot_leaf_teeth = open(
            Parameters.results + '/html/html_summary_plot_leaf_teeth.html',
            'w')
        f4 = open('../resources/html/index_plot_leaf_teeth.html', "r")
        my_html_test_doc_plot_cm = f4.read().split('\n')

        number_of_teeth = tsv_data_to_html["NumberofTeeth"].tolist()
        string_number_of_teeth_array = "var x10=[numberofteeth]"
        html_index = my_html_test_doc_plot_cm.index(
            string_number_of_teeth_array)
        my_html_test_doc_plot_cm[html_index] = "var x10=%s" % number_of_teeth

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_teeth.write(str_for_html)
        f_plot_leaf_teeth.close()
        f4.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_teeth.html'
        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_teeth_output_config_file(
            Parameters.results + '/html/html_summary_plot_leaf_teeth.html')
        #####################
        print "Adding number of teeth boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Number of Teeth")
        plt.boxplot(number_of_teeth, 0, 'rs', 0)
        boxplot_path_number_of_teeth = Parameters.results + "/images/plot_number_of_teeth.png"
        savefig(boxplot_path_number_of_teeth)
        self.config_file.number_of_teeth_boxplot_output_config_file(
            boxplot_path_number_of_teeth)

        #####################
        # shape descriptors
        f_plot_leaf_shape = open(
            Parameters.results + '/html/html_summary_plot_leaf_shape.html',
            'w')
        f5 = open('../resources/html/index_plot_leaf_shape.html', "r")
        my_html_test_doc_plot_cm = f5.read().split('\n')

        aspect_ratio = tsv_data_to_html["AspectRatio"].tolist()
        string_aspect_ratio_array = "var x0=[aspectratio]"
        html_index = my_html_test_doc_plot_cm.index(string_aspect_ratio_array)
        my_html_test_doc_plot_cm[html_index] = "var x0=%s" % aspect_ratio
        #####################
        print "Adding aspect ratio boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Aspect Ratio")
        plt.boxplot(aspect_ratio, 0, 'rs', 0)
        boxplot_path_aspect_ratio = Parameters.results + "/images/plot_aspect_ratio.png"
        savefig(boxplot_path_aspect_ratio)
        self.config_file.aspect_ratio_boxplot_output_config_file(
            boxplot_path_aspect_ratio)

        #####################

        perimeter_ratio_of_length = tsv_data_to_html[
            "Perimeter Ratio of Length"].tolist()
        string_perimeter_ratio_of_length_array = "var x4=[perimeterratiooflength]"
        html_index = my_html_test_doc_plot_cm.index(
            string_perimeter_ratio_of_length_array)
        my_html_test_doc_plot_cm[
            html_index] = "var x4=%s" % perimeter_ratio_of_length
        #####################
        print "Adding perimeter_ratio_of_length boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter Ratio of Length")
        plt.boxplot(perimeter_ratio_of_length, 0, 'rs', 0)
        boxplot_path_perimeter_ratio_of_length = Parameters.results + "/images/plot_perimeter_ratio_of_length.png"
        savefig(boxplot_path_perimeter_ratio_of_length)
        self.config_file.perimeter_ratio_of_length_boxplot_output_config_file(
            boxplot_path_perimeter_ratio_of_length)

        #####################

        perimeter_ratio_of_length_and_width = tsv_data_to_html[
            "Perimeter Ratio of Length and Width"].tolist()
        string_perimeter_ratio_of_length_and_width_array = "var x5=[perimeterratiooflengthandwidth]"
        html_index = my_html_test_doc_plot_cm.index(
            string_perimeter_ratio_of_length_and_width_array)
        my_html_test_doc_plot_cm[
            html_index] = "var x5=%s" % perimeter_ratio_of_length_and_width
        #####################
        print "Adding perimeter_ratio_of_length_and_width boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter Ratio of Length and Width")
        plt.boxplot(perimeter_ratio_of_length_and_width, 0, 'rs', 0)
        boxplot_path_perimeter_ratio_of_length_and_withd = Parameters.results + "/images/plot_perimeter_ratio_of_length_and_width.png"
        savefig(boxplot_path_perimeter_ratio_of_length_and_withd)
        self.config_file.perimeter_ratio_of_length_and_width_boxplot_output_config_file(
            boxplot_path_perimeter_ratio_of_length_and_withd)

        #####################
        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_shape.write(str_for_html)
        f_plot_leaf_shape.close()
        f5.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_shape.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_shape_output_config_file(
            Parameters.results + '/html/html_summary_plot_leaf_shape.html')
        # shapedescriptors2

        f_plot_leaf_shape2 = open(
            Parameters.results + '/html/html_summary_plot_leaf_shape2.html',
            'w')
        f6 = open('../resources/html/index_plot_leaf_shape2.html', "r")
        my_html_test_doc_plot_cm = f6.read().split('\n')

        roundness = tsv_data_to_html["Roundness"].tolist()
        string_roundness_array = "var x1=[roundness]"
        html_index = my_html_test_doc_plot_cm.index(string_roundness_array)
        my_html_test_doc_plot_cm[html_index] = "var x1=%s" % roundness
        #####################
        print "Adding roundness boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Roundness")
        plt.boxplot(roundness, 0, 'rs', 0)
        boxplot_path_roundness = Parameters.results + "/images/plot_roundness.png"
        savefig(boxplot_path_roundness)
        self.config_file.roundness_boxplot_output_config_file(
            boxplot_path_roundness)

        #####################
        rectangularity = tsv_data_to_html["Rectangularity"].tolist()
        string_rectangularity_array = "var x3=[rectangularity]"
        html_index = my_html_test_doc_plot_cm.index(
            string_rectangularity_array)
        my_html_test_doc_plot_cm[html_index] = "var x3=%s" % rectangularity
        #####################
        print "Adding rectangularity boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Rectangularity")
        plt.boxplot(rectangularity, 0, 'rs', 0)
        boxplot_path_rectangularity = Parameters.results + "/images/plot_rectangularity.png"
        savefig(boxplot_path_rectangularity)
        self.config_file.rectangularity_boxplot_output_config_file(
            boxplot_path_rectangularity)

        #####################

        perimeter_convexity = tsv_data_to_html["Perimeter Convexity"].tolist()
        string_perimeter_convexity_array = "var x6=[perimeterconvexity]"
        html_index = my_html_test_doc_plot_cm.index(
            string_perimeter_convexity_array)
        my_html_test_doc_plot_cm[
            html_index] = "var x6=%s" % perimeter_convexity
        #####################
        print "Adding perimeter convexity boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter Convexity")
        plt.boxplot(perimeter_convexity, 0, 'rs', 0)
        boxplot_path_perimeter_convexity = Parameters.results + "/images/plot_perimeter_convexity.png"
        savefig(boxplot_path_perimeter_convexity)
        self.config_file.perimeter_convexity_boxplot_output_config_file(
            boxplot_path_perimeter_convexity)

        #####################
        area_convexity = tsv_data_to_html["Area Convexity"].tolist()
        string_area_convexity_array = "var x7=[areaconvexity]"
        html_index = my_html_test_doc_plot_cm.index(
            string_area_convexity_array)
        my_html_test_doc_plot_cm[html_index] = "var x7=%s" % area_convexity
        #####################
        print "Adding area convexity boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Area Convexity")
        plt.boxplot(area_convexity, 0, 'rs', 0)
        boxplot_path_area_convexity = Parameters.results + "/images/plot_area_convexity.png"
        savefig(boxplot_path_area_convexity)
        self.config_file.area_convexity_boxplot_output_config_file(
            boxplot_path_area_convexity)

        #####################
        area_ratio_of_convexity = tsv_data_to_html[
            "Area Ratio of Convexity"].tolist()
        string_area_ratio_of_convexity_array = "var x8=[arearatioofconvexity]"
        html_index = my_html_test_doc_plot_cm.index(
            string_area_ratio_of_convexity_array)
        my_html_test_doc_plot_cm[
            html_index] = "var x8=%s" % area_ratio_of_convexity
        #####################
        print "Adding area ratio of convexity boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Area Ratio of Convexity")
        plt.boxplot(area_ratio_of_convexity, 0, 'rs', 0)
        boxplot_path_area_ratio_of_convexity = Parameters.results + "/images/plot_area_ratio_of_convexity.png"
        savefig(boxplot_path_area_ratio_of_convexity)
        self.config_file.area_ratio_of_convexity_boxplot_output_config_file(
            boxplot_path_area_ratio_of_convexity)

        #####################

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_shape2.write(str_for_html)
        f_plot_leaf_shape2.close()
        f6.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_shape2.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_shape2_output_config_file(
            Parameters.results + '/html/html_summary_plot_leaf_shape2.html')
        # compactness
        f_plot_leaf_compactness = open(
            Parameters.results +
            '/html/html_summary_plot_leaf_compactness.html', 'w')
        f7 = open('../resources/html/index_plot_leaf_compactness.html', "r")
        my_html_test_doc_plot_cm = f7.read().split('\n')
        compactness = tsv_data_to_html["Compactness"].tolist()
        string_compactness_array = "var x2=[compactness]"
        html_index = my_html_test_doc_plot_cm.index(string_compactness_array)
        my_html_test_doc_plot_cm[html_index] = "var x2=%s" % compactness
        #####################
        print "Adding compactness boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Compactness")
        plt.boxplot(compactness, 0, 'rs', 0)
        boxplot_path_compactness = Parameters.results + "/images/plot_compactness.png"
        savefig(boxplot_path_compactness)
        self.config_file.compactness_boxplot_output_config_file(
            boxplot_path_compactness)

        #####################
        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc[html_index] = dashboard_string

        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_compactness.write(str_for_html)
        f_plot_leaf_compactness.close()
        f7.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_compactness.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_compactness_output_config_file(
            Parameters.results +
            '/html/html_summary_plot_leaf_compactness.html')

        # equivalent diameter in cm
        f_plot_leaf_eqd_cm = open(
            Parameters.results + '/html/html_summary_plot_leaf_eqd_cm.html',
            'w')
        f8 = open('../resources/html/index_plot_leaf_eqd_cm.html', "r")
        my_html_test_doc_plot_cm = f8.read().split('\n')
        equivalent_diameter = tsv_data_to_html[
            "Equivalent Diameter cm"].tolist()
        string_equivalent_diameter_array = "var x9=[equivalentdiameter]"
        html_index = my_html_test_doc_plot_cm.index(
            string_equivalent_diameter_array)
        my_html_test_doc_plot_cm[
            html_index] = "var x9=%s" % equivalent_diameter
        #####################
        print "Adding equivalent diameter cm boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Equivalent Diameter in cm")
        plt.boxplot(equivalent_diameter, 0, 'rs', 0)
        boxplot_path_eqd_cm = Parameters.results + "/images/plot_eqd_cm.png"
        savefig(boxplot_path_eqd_cm)
        self.config_file.eqd_cm_boxplot_output_config_file(boxplot_path_eqd_cm)

        #####################
        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"bootstrap.min.css\" rel=\"stylesheet\">")
        bootstrap_string = "<link href=\"" + Parameters.resources + "/css/bootstrap.min.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = bootstrap_string

        html_index = my_html_test_doc_plot_cm.index(
            "<link href=\"dashboard.css\" rel=\"stylesheet\">")
        dashboard_string = "<link href=\"" + Parameters.resources + "/css/dashboard.css\" rel=\"stylesheet\">"
        my_html_test_doc_plot_cm[html_index] = dashboard_string
        str_for_html = "\n".join(my_html_test_doc_plot_cm)
        f_plot_leaf_eqd_cm.write(str_for_html)
        f_plot_leaf_eqd_cm.close()
        f8.close()

        filename_plot_cm = 'file://' + Parameters.results + '/html/html_summary_plot_leaf_eqd_cm.html'

        # add success for this process to the config
        self.config_file.html_summary_plot_leaf_eqd_cm_output_config_file(
            Parameters.results + '/html/html_summary_plot_leaf_eqd_cm.html')

        boxplot_pixels = open(
            Parameters.results + '/html/html_boxplot_pixels.html', 'w')
        boxplot_template = open(
            Parameters.resources + '/html/boxplot_template.html', "r")
        my_html_boxplot_pixels = boxplot_template.read().split('\n')

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"1\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_length_pixels.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"2\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_width_pixels.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"3\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_area_pixels.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"4\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_perimeter_pixels.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"5\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_eqd_pixels.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"6\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_area_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"7\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_area_ratio_of_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"8\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_aspect_ratio.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"9\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_compactness.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"10\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_number_of_teeth.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"11\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_perimeter_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"12\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_perimeter_ratio_of_length.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"13\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_perimeter_ratio_of_length_and_width.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"14\" width=\"400\" />"
        html_index = my_html_boxplot_pixels.index(string_to_change)
        my_html_boxplot_pixels[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_roundness.png")

        str_for_html = "\n".join(my_html_boxplot_pixels)
        boxplot_pixels.write(str_for_html)
        boxplot_pixels.close()
        boxplot_template.close()
        boxplot_pixels_string = Parameters.results + '/html/html_boxplot_pixels.html'
        self.config_file.html_boxplot_pixels_output_config_file(
            boxplot_pixels_string)
        ### CM ####
        boxplot_cm = open(Parameters.results + '/html/html_boxplot_cm.html',
                          'w')
        boxplot_template = open(
            Parameters.resources + '/html/boxplot_template.html', "r")
        my_html_boxplot_cm = boxplot_template.read().split('\n')

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"1\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_length_cm.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"2\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_width_cm.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"3\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_area_cm.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"4\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_perimeter_cm.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"5\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_eqd_cm.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"6\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_area_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"7\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_area_ratio_of_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"8\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_aspect_ratio.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"9\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_compactness.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"10\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_number_of_teeth.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"11\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_perimeter_convexity.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"12\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_perimeter_ratio_of_length.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"13\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results +
                "/images/plot_perimeter_ratio_of_length_and_width.png")

        string_to_change = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"14\" width=\"400\" />"
        html_index = my_html_boxplot_cm.index(string_to_change)
        my_html_boxplot_cm[
            html_index] = "<img style=\"float: left; margin: 0px 0px 15px 15px;\" src=\"%s\" width=\"400\" />" % (
                Parameters.results + "/images/plot_roundness.png")

        str_for_html = "\n".join(my_html_boxplot_cm)
        boxplot_cm.write(str_for_html)
        boxplot_cm.close()
        boxplot_template.close()
        boxplot_cm_string = Parameters.results + '/html/html_boxplot_cm.html'
        self.config_file.html_boxplot_cm_output_config_file(boxplot_cm_string)
Exemple #5
0
 def __init__(self, path):
     self.images = []
     self.path = path
     self.config_file = ConfigMaker(self.path)
     self.image_name = ""
Exemple #6
0
class HtmlMaker:

    def __init__(self, path):
        self.images = []
        self.path = path
        self.config_file = ConfigMaker(self.path)
        self.image_name = ""
        #self.config_file = ConfigMaker(Parameters.results + "/summary_output.config")

    def accession_area_pixel_maker(self, rep_area, image_name):
        self.image_name = image_name
        accession_area_plot_html_file = Parameters.results + "/html/"+ self.image_name+"_accession_area_violin.html"
        outF = open(accession_area_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_area.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Area]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % rep_area
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + accession_area_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.accession_area_plot_html_output_config_file(accession_area_plot_html_file)
        #####################
        print "Adding area pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Area of seeds in accession in Pixels")
        plt.boxplot(rep_area, 0, 'rs', 0)
        boxplot_path_accession_area_pixels = Parameters.results + "/images/"+self.image_name+"_plot_accession_area_pixels.png"
        savefig(boxplot_path_accession_area_pixels)
        self.config_file.accession_area_pixels_boxplot_output_config_file(boxplot_path_accession_area_pixels)

    def accession_eqd_pixel_maker(self, rep_eqd,image_name):
        self.image_name = image_name
        accession_eqd_plot_html_file = Parameters.results + '/html/'+self.image_name+'_accession_eqd_violin.html'
        outF = open(accession_eqd_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_eqd.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Eqd]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % rep_eqd
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + accession_eqd_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.accession_eqd_plot_html_output_config_file(accession_eqd_plot_html_file)
        #####################
        print "Adding equivalent diameter pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Equivalent Diameter of seeds in accession in Pixels")
        plt.boxplot(rep_eqd, 0, 'rs', 0)
        boxplot_path_accession_eqd_pixels = Parameters.results + "/images/"+self.image_name+"_plot_accession_eqd_pixels.png"
        savefig(boxplot_path_accession_eqd_pixels)
        self.config_file.accession_eqd_pixels_boxplot_output_config_file(boxplot_path_accession_eqd_pixels)

    def accession_perimeter_pixel_maker(self, rep_perimeter, image_name):
        self.image_name = image_name
        accession_perimeter_plot_html_file = Parameters.results + '/html/'+self.image_name+'_accession_perimeter_violin.html'
        outF = open(accession_perimeter_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_perimeter.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Perimeter]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % rep_perimeter
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + accession_perimeter_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.accession_perimeter_plot_html_output_config_file(accession_perimeter_plot_html_file)
        #####################
        print "Adding perimeter pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Perimeter of seeds in accession in Pixels")
        plt.boxplot(rep_perimeter, 0, 'rs', 0)
        boxplot_path_accession_perimeter_pixels = Parameters.results + "/images/"+self.image_name+"_plot_accession_perimeter_pixels.png"
        savefig(boxplot_path_accession_perimeter_pixels)
        self.config_file.accession_perimeter_pixels_boxplot_output_config_file(boxplot_path_accession_perimeter_pixels)

    def accession_seed_table_file_maker(self,seed_table, image_name):
        self.image_name = image_name
        accession_seed_table_file = Parameters.results + "/html/"+self.image_name+"_accession_seed_table.html"
        outTable = open(accession_seed_table_file, "w")
        inTable = open(Parameters.resources + '/html/index.html', "r")
        my_html_test_doc = inTable.read().split('\n')

        string_to_be_substituted = "THIS IS TABLE"
        html_index = my_html_test_doc.index(string_to_be_substituted)
        my_html_test_doc[html_index] = seed_table
        str_for_html = "\n".join(my_html_test_doc)
        outTable.write(str_for_html)
        outTable.close()
        inTable.close()

        filename_plot = 'file://' + accession_seed_table_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.accession_table_html_output_config_file(accession_seed_table_file)

    def accession_method_html_maker(self, original_image_jpg_file, hsv_jpg_file,mask_png_file,seed_labels_jpg_file,imposed_annotation_jpg_file, image_name):
        self.image_name = image_name
        seed_method_file = Parameters.results + "/html/"+self.image_name+"_accession_method_seed.html"
        outF = open(seed_method_file, "w")
        inF = open(Parameters.resources + '/html/method_index.html', "r")
        my_html_test_doc_method = inF.read().split('\n')

        string_to_be_substituted = "<img class=\"card-img-top\" data-src=\"PICTURE\" alt=\"Card image cap\">"
        html_index = my_html_test_doc_method.index(string_to_be_substituted)
        method_string = "<img class=\"card-img-top\" src=\"%s\" alt=\"Card image cap\">" % original_image_jpg_file
        my_html_test_doc_method[html_index] = method_string

        string_to_be_substituted = "<img class=\"card-img-top\" data-src=\"PICTURE2\" alt=\"Card image cap\">"
        html_index = my_html_test_doc_method.index(string_to_be_substituted)
        method_string = "<img class=\"card-img-top\" src=\"%s\" alt=\"Card image cap\">" % hsv_jpg_file
        my_html_test_doc_method[html_index] = method_string

        string_to_be_substituted = "<img class=\"card-img-top\" data-src=\"PICTURE3\" alt=\"Card image cap\">"
        html_index = my_html_test_doc_method.index(string_to_be_substituted)
        method_string = "<img class=\"card-img-top\" src=\"%s\" alt=\"Card image cap\">" % mask_png_file
        my_html_test_doc_method[html_index] = method_string

        string_to_be_substituted = "<img class=\"card-img-top\" data-src=\"PICTURE4\" alt=\"Card image cap\">"
        html_index = my_html_test_doc_method.index(string_to_be_substituted)
        method_string = "<img class=\"card-img-top\" src=\"%s\" alt=\"Card image cap\">" % seed_labels_jpg_file
        my_html_test_doc_method[html_index] = method_string

        string_to_be_substituted = "<img class=\"card-img-top\" data-src=\"PICTURE5\" alt=\"Card image cap\">"
        html_index = my_html_test_doc_method.index(string_to_be_substituted)
        method_string = "<img class=\"card-img-top\" src=\"%s\" alt=\"Card image cap\">" % imposed_annotation_jpg_file
        my_html_test_doc_method[html_index] = method_string
        str_for_html = "\n".join(my_html_test_doc_method)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + seed_method_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.accession_method_html_output_config_file(seed_method_file)

    def summary_table_maker(self, summary_csv_file):
        print "Making html summary."
        summary_file = open(summary_csv_file, "r")
        columns = ['Accession',
                   'Number of Seeds',
                   'Mean Area Pixels',
                   'Mean Equivalent Diameter Pixels',
                   'Mean Perimeter Pixels']
        df = pd.read_csv(summary_file, names=columns)
        html_table = df.to_html(justify='left')
        list_seed_table = html_table.split('\n')
        del list_seed_table[0]
        del list_seed_table[-1]
        seed_table_summary = "\n".join(list_seed_table)
        summary_file.close()
        summary_seed_html_table_file = Parameters.results + "/html/summary_seed_table.html"
        outTable = open(summary_seed_html_table_file, "w")
        inTable = open(Parameters.resources + '/html/index.html', "r")
        my_html_test_doc = inTable.read().split('\n')

        string_to_be_substituted = "THIS IS TABLE"
        html_index = my_html_test_doc.index(string_to_be_substituted)
        my_html_test_doc[html_index] = seed_table_summary
        str_for_html = "\n".join(my_html_test_doc)
        outTable.write(str_for_html)
        outTable.close()
        inTable.close()

        filename_plot = 'file://' + summary_seed_html_table_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.summary_table_html_output_config_file(summary_seed_html_table_file)
        self.config_file.summary_csv_output_config_file(summary_csv_file)
        summary_file.close()

    def summary_perimeter_pixel_maker(self):
        summaryfile = open(Parameters.results + "/tables/workfile.csv", "r")
        header_names = ["Accession",
                        "Number of Seeds",
                        "Mean Area Pixels",
                        "Mean Equivalent Diameter Pixels",
                        "Mean Perimeter Pixels"]
        df = pd.read_csv(summaryfile, names=header_names)
        summary_perimeter = []
        for i in df["Mean Perimeter Pixels"]:
            summary_perimeter.append(i)

        summary_perimeter_plot_html_file = Parameters.results + '/html/summary_perimeter_violin.html'
        outF = open(summary_perimeter_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_perimeter.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Perimeter]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % summary_perimeter
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + summary_perimeter_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.summary_perimter_pixels_html_output_config_file(summary_perimeter_plot_html_file)
        #####################
        print "Adding summary perimeter pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Average Perimeter of seeds in summary in Pixels")
        plt.boxplot(summary_perimeter, 0, 'rs', 0)
        boxplot_path_summary_perimeter_pixels = Parameters.results + "/images/plot_summary_perimeter_pixels.png"
        savefig(boxplot_path_summary_perimeter_pixels)
        self.config_file.summary_perimeter_pixels_boxplot_output_config_file(boxplot_path_summary_perimeter_pixels)

    def summary_area_pixel_maker(self):
        summaryfile = open(Parameters.results + "/tables/workfile.csv", "r")
        header_names = ["image_name",
                        "numberofseeds",
                        "area_mean_pix",
                        "eqd_mean_pix",
                        "perimeter_mean_pix",
                        "mean_max_mins",
                        "pix_per_cm",
                        "area_mean_cm",
                        "eqd_mean_cm",
                        "perimeter_mean_cm"]
        df = pd.read_csv(summaryfile, names=header_names)
        summary_area = []
        for i in df["area_mean_pix"]:
            summary_area.append(i)

        summary_area_plot_html_file = Parameters.results + '/html/summary_area_violin.html'
        outF = open(summary_area_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_area.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Area]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % summary_area
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + summary_area_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.summary_area_pixels_html_output_config_file(summary_area_plot_html_file)
        #####################
        print "Adding summary area pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Average Area of seeds in summary in Pixels")
        plt.boxplot(summary_area, 0, 'rs', 0)
        boxplot_path_summary_area_pixels = Parameters.results + "/images/plot_summary_area_pixels.png"
        savefig(boxplot_path_summary_area_pixels)
        self.config_file.summary_area_pixels_boxplot_output_config_file(boxplot_path_summary_area_pixels)

    def summary_eqd_pixel_maker(self):
        summaryfile = open(Parameters.results + "/tables/workfile.csv", "r")
        header_names = ["image_name",
                        "numberofseeds",
                        "area_mean_pix",
                        "eqd_mean_pix",
                        "perimeter_mean_pix",
                        "mean_max_mins",
                        "pix_per_cm",
                        "area_mean_cm",
                        "eqd_mean_cm",
                        "perimeter_mean_cm"]
        df = pd.read_csv(summaryfile, names=header_names)
        summary_eqd = []
        for i in df["eqd_mean_pix"]:
            summary_eqd.append(i)

        summary_eqd_plot_html_file = Parameters.results + '/html/summary_eqd_violin.html'
        outF = open(summary_eqd_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_single_eqd.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Eqd]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % summary_eqd
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + summary_eqd_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.summary_eqd_pixels_html_output_config_file(summary_eqd_plot_html_file)
        #####################
        print "Adding summary eqd pixels boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Average Equivalent Diameter of seeds in summary in Pixels")
        plt.boxplot(summary_eqd, 0, 'rs', 0)
        boxplot_path_summary_eqd_pixels = Parameters.results + "/images/plot_summary_eqd_pixels.png"
        savefig(boxplot_path_summary_eqd_pixels)
        self.config_file.summary_eqd_pixels_boxplot_output_config_file(boxplot_path_summary_eqd_pixels)

    def summary_numberofseeds_pixel_maker(self):
        summaryfile = open(Parameters.results + "/tables/workfile.csv", "r")
        header_names = ["image_name",
                        "numberofseeds",
                        "area_mean_pix",
                        "eqd_mean_pix",
                        "perimeter_mean_pix",
                        "mean_max_mins",
                        "pix_per_cm",
                        "area_mean_cm",
                        "eqd_mean_cm",
                        "perimeter_mean_cm"]
        df = pd.read_csv(summaryfile, names=header_names)
        summary_number_of_seeds = []
        for i in df["numberofseeds"]:
            summary_number_of_seeds.append(i)

        summary_number_of_seeds_plot_html_file = Parameters.results + '/html/summary_numberofseeds_violin.html'
        outF = open(summary_number_of_seeds_plot_html_file, "w")
        inF = open(Parameters.resources + '/html/index_summary_numberofseeds.html', "r")
        my_html_test_doc_plot = inF.read().split('\n')

        string_to_be_substituted = "var x10=[Number]"
        html_index = my_html_test_doc_plot.index(string_to_be_substituted)
        my_html_test_doc_plot[html_index] = "var x10=%s" % summary_number_of_seeds
        str_for_html = "\n".join(my_html_test_doc_plot)
        outF.write(str_for_html)
        outF.close()
        inF.close()

        filename_plot = 'file://' + summary_number_of_seeds_plot_html_file
        #webbrowser.get().open_new_tab(filename_plot)
        self.config_file.summary_numberofseeds_html_output_config_file(summary_number_of_seeds_plot_html_file)
        #####################
        print "Adding summary number of seeds boxplot to config file."
        pos = [1]
        fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(20, 20))
        plt.figure()
        plt.xlabel("Number of seeds in summary")
        plt.boxplot(summary_number_of_seeds, 0, 'rs', 0)
        boxplot_path_summary_number_of_seeds= Parameters.results + "/images/plot_summary_number_of_seeds.png"
        savefig(boxplot_path_summary_number_of_seeds)
        self.config_file.summary_number_of_seeds_boxplot_output_config_file(boxplot_path_summary_number_of_seeds)