def createCompositeExp(inputData, subspaceDict, knn=knn): print('----createCompositeHeidi----') #INITIALIZING THE HEIDI MATRIX row = inputData.shape[0] heidi_matrix = np.zeros(shape=(row, row), dtype=np.uint64) imgDict = {} bitmask = [] subspaceList = [] colorList = [] #factor=1 j = 1 print(subspaceDict) #FOR EACH COLOR IN SUBSPACE DICTIONARY for color in subspaceDict: allsubspace = subspaceDict[color][0] #1. SORTING AND FILTERING THE DATA if len(allsubspace) == 1: param = {} param['columns'] = allsubspace param['order'] = [True for i in param['columns']] ordering = 'dimension' else: param = {} #ordering='pca_ordering' #ordering='euclidian_distance' ordering = 'knn_bfs' #ordering='mst_distance' #print(allsubspace,ordering) filtered_data = inputData[allsubspace + ['classLabel']] filtered_data['classLabel_orig'] = filtered_data['classLabel'].values #print(filtered_data) sorted_data = op.sortbasedOnclassLabel(filtered_data, ordering, param) #SELECTING COLUMNS OF INPUT DATA BASED ON SUBSPACE filtered_data = sorted_data[allsubspace] subspace = filtered_data np_subspace = subspace.values #NEED TO CHANGE IF COL IS A LIST #CREATING KNN MATRIX nbrs = NearestNeighbors(n_neighbors=knn, algorithm='ball_tree').fit(np_subspace) hm = nbrs.kneighbors_graph(np_subspace).toarray() temp = np.flip(hm, 0) bitmask = bitmask + [temp == 0] subspaceList = subspaceList + [set(allsubspace)] colorList = colorList + [color] hm = hm.astype(np.uint64) img, _ = hh.generateHeidiImage_hex(hm, {1: color}) hh.saveHeidiImage(img, 'static/output_exp', 'img' + str(j) + '.png') j = j + 1 imgDict[color] = img return imgDict, bitmask, subspaceList, colorList
def generateHeidiMatrixResults_test4(outputPath, inputData, k): global global_count, global_map_dict create_empty_folder(outputPath) global_count = 0 factor = 1 bit_subspace = {} row = inputData.shape[0] count = 0 heidi_matrix = np.zeros(shape=(row, row), dtype=np.uint64) allsubspaces = get_all_kd_subspaces(k, inputData.shape[1] - 1) print(allsubspaces) print('knn:', knn) for col in range(0, inputData.shape[1] - 1): filtered_data = inputData.iloc[:, [col, -1]] #NEED TO CHANGE IF COL IS A LIST param = {} param['columns'] = list(filtered_data.columns[:-1]) param['order'] = [True for i in param['columns']] sorted_data = op.sortbasedOnclassLabel(filtered_data, 'dimension', param) subspace = sorted_data.iloc[:, :-1] np_subspace = subspace.values #NEED TO CHANGE IF COL IS A LIST #print(np_subspace.shape) nbrs = NearestNeighbors(n_neighbors=knn, algorithm='ball_tree').fit(np_subspace) temp = nbrs.kneighbors_graph(np_subspace).toarray() temp = temp.astype(np.uint64) heidi_matrix = heidi_matrix + temp * factor factor = factor * 2 bit_subspace[count] = col count += 1 map_dict, all_info = hh.getMappingDict(heidi_matrix, bit_subspace) hh.createLegend(map_dict, all_info, outputPath + '/legend.html') img, imgarray = hh.generateHeidiImage(heidi_matrix, map_dict) hh.saveHeidiImage(img, outputPath, 'img_bea.png') array = sorted_data['classLabel'].value algo1_bar, t = hh.createBar(array) hh.visualizeConsolidatedImage(imgarray, algo1_bar, outputPath + '/consolidated_img.png') print('visualized consolidated image')
def image(): #print('---heidicontrollers:image()------') #---------------1. INPUT PARAMETER READING ---------------------------------------------- #INPUT PARAMS FROM WEB PAGE (DIMENSION.HTML) #try: order_dim = request.args.get('order_dim') selected_dim = request.args.get('selectedDim') datasetPath = request.args.get('datasetPath') grid = request.args.get('grid') knn = int(request.args.get('knn')) imgType = '_' + request.args.get('imgType') if (grid == 'yes'): grid = True else: grid = False rowfilterDict = ast.literal_eval(request.args.get('filterDict')) print('params', order_dim, selected_dim, datasetPath, rowfilterDict, imgType, knn) # write code here for error handling if order_dim is invalid # READING THE DATASET data = pd.read_csv(filepath_or_buffer=datasetPath, sep=',', index_col='id') #IF THERE IS ANY ROW FILTER OPTION, FILTERING OF ROWS for k in rowfilterDict.keys(): data = data.loc[data[k].isin([rowfilterDict[k]])] #CONVERT JAVASCRIPT OBJECT OF ORDERDIM IN PYTHON LIST dim = [] if (order_dim != ''): dim = [s for s in order_dim.split(' ')] #FILTERING THE COLUMNS IN ORDERDIM AND CLASSLABEL filtered_data = pd.concat([ data.loc[:, dim + ['classLabel']], data.loc[:, list(rowfilterDict.keys())] ], axis=1) #filename_data=hd.normalize_data(filtered_data) filtered_data['classLabel_orig'] = filtered_data['classLabel'].values #filtered_data=filtered_data.drop(list(rowfilterDict.keys()),axis=1) print(filtered_data.columns, filtered_data) #---------------2. ORDERING POINTS ---------------------------------------------- # IF ORDERDIM LENGTH =1 THEN ORDERING BY SORTED ORDER ELSE SOME OTHER ORDERING SCHEMA if len(dim) == 1: param = {} param['columns'] = list(filtered_data.columns[:-1]) param['order'] = [True for i in param['columns']] sorted_data = op.sortbasedOnclassLabel(filtered_data, 'dimension', param) # REINDEXING THE INPUT DATA (TO BE USED LATER) sorting_order = sorted_data.index data = data.reindex(sorting_order) else: print('mst ordering') param = {} sorted_data = op.sortbasedOnclassLabel( filtered_data, 'knn_bfs', param) #'mst_distance' #connected_distance #sorted_data=op.sortbasedOnclassLabel(filtered_data,'euclidian_distance',param) sorting_order = sorted_data.index data = data.reindex(sorting_order) '''4-JUNE BEA (UNCOMMENT IF YOU WANT BEA) output='static/output' t=filtered_data.copy() del t['classLabel_orig'] hd_matrix,_,_=hd.generateHeidiMatrixResults_noorder(output,t,20) # remove waste sorted_data #print(hd_matrix) c=filtered_data['classLabel'].values print('calling bea') sorting_order=bea2.BEA_clusterwise(hd_matrix,c) #print('sorted order obtained is ',sorting_order) filtered_data['classLabel_orig']=filtered_data['classLabel'] data=data.reset_index() data=data.reindex(sorting_order) data.index=data['id'] del data['id'] ''' print('SUCCESSFULLY ORDERED POINTS!!') #ORDERING OF POINTS FINISHED #---------------3. INPUT PARAMETERS, ORDER DIM + SELECTED DIM + filtering columns ---------------------------------------------- # CONVERT JAVASCRIPT OBJECT OF SELECT-COLUMN INTO PYTHON LIST dims = [] if (selected_dim != ''): dims = [s for s in selected_dim.split(' ')] # ORDERDIM + SELECT-DIM dims = dims + dim # REMOVING THE DUPLICATED FROM MERGED LIST dims = list(set(dims)) # FINAL FILTERING THE COLUMNS filtered_data = data.loc[:, dims + ['classLabel']] #print(filtered_data,filtered_data.columns,filtered_data.describe()) #--------------- 4. BASIC HEIDI IMAGE --------------------------------------------------------------- output = 'static/output' matrix, bs, sorted_data = hd.generateHeidiMatrixResults_noorder( output, filtered_data, knn) print('----matrix generated ---') #5-june img, bit_subspace = hd.generateHeidiMatrixResults_noorder_helper( matrix, bs, output, sorted_data, 'legend_heidi') output = 'static/output' filename = 'consolidated_img.png' img.save(output + '/' + filename) print('--generated image ---') #lbl=rg.regionLabelling_8(matrix) lbl = np.zeros((matrix.shape[0], matrix.shape[1])) print('--region labelling done ---') dbc.deleteAllNodes(labelname=os.path.basename(datasetPath).split('.')[0] + '_heidi') dbc.saveMatrixToDatabase_leaf( img, bs, 'static/output', sorted_data, lbl, labelname=os.path.basename(datasetPath).split('.')[0] + '_heidi') dbc.saveColorToDatabase( bit_subspace, os.path.basename(datasetPath).split('.')[0] + '_heidi') filtered_data.to_csv('static/output/sortedData.csv') x = list(filtered_data['classLabel'].values) #--------------- SAVING IMAGE INFO AND LABEL COLORS, ONE TIME --------------------------------------------------------------- dbc.saveClassLabelColorsInDatabase(os.path.basename(datasetPath), list(set(x))) l = [] label = [] for i in set(x): c = x.count(i) l.append(c) label.append(i) l = ','.join([str(i) for i in l]) label = ','.join([str(i) for i in label]) dbc.saveInfoToDatabase(img.size[0], img.size[1], os.path.basename(datasetPath), l, label) #check above line (WARNING) #storing the re-indexed data at output folder output = 'static/output' data.to_csv(output + '/sortedData.csv', index=True) ''' #--------------- 4B. CLOSED HEIDI IMAGE --------------------------------------------------------------- #4-JUNE #CODE FOR CREATING CLOSED IMAGE AND SAVING IN DATABASE #matrix,bs,sorted_data=hd.generateHeidiMatrixResults_noorder(output,filtered_data,20) bm = ch.get_bit_map(filtered_data.shape[1]-1) map_dict,_=hh.getMappingDict(matrix,bs) matrix,val_map=ch.compress_heidi(matrix,bm) print('val_map:',val_map,bs) lbl=rg.regionLabelling_8(matrix) img,dict1=hd.generateHeidiMatrixResults_noorder_helper(matrix,bs,output,sorted_data,'legend_closed',val_map,map_dict) dbc.deleteAllNodes(labelname=os.path.basename(datasetPath).split('.')[0]+'_closed') dbc.saveMatrixToDatabase_leaf_v2(img,bs,'static/output',sorted_data,lbl,labelname=os.path.basename(datasetPath).split('.')[0]+'_closed') dbc.saveColorToDatabase(dict1,os.path.basename(datasetPath).split('.')[0]+'_closed') output='static/output' filename='closed_img.png' img.save(output+'/'+filename) #CLOSED IMAGE CODE END #--------------- 5. COMPOSITE HEIDI IMAGE --------------------------------------------------------------- #5june #HEIDI image to composite and saving in database color_dict,_=dbc.loadColorFromDatabase(os.path.basename(datasetPath).split('.')[0]+'_heidi') temp={} for k in color_dict: temp[k.replace('H','#')]=color_dict[k] print('color_dict',temp,filtered_data) img,matrix=hd.createCompositeHeidi(filtered_data,temp,knn=20) lbl=rg.regionLabelling_8(matrix) dbc.deleteAllNodes(labelname=os.path.basename(datasetPath).split('.')[0]+'_composite') dbc.saveMatrixToDatabase_leaf_v2(img,'','static/output',sorted_data,lbl,labelname=os.path.basename(datasetPath).split('.')[0]+'_composite') print('saved composite image in database!!') output='static/output' filename='consolidated_composite.png' img.save(output+'/'+filename) ''' #--------------- 6. CLOSED COMPOSITE IMAGE --------------------------------------------------------------- ''' #CLOSED image to composite and saving in database color_dict,_=dbc.loadColorFromDatabase(os.path.basename(datasetPath).split('.')[0]+'_closed') temp={} for k in color_dict: temp[k.replace('H','#')]=color_dict[k] img,matrix=hd.createCompositeHeidi(filtered_data,temp,knn=20) lbl=rg.regionLabelling_8(matrix) dbc.deleteAllNodes(labelname=os.path.basename(datasetPath).split('.')[0]+'closed_composite') dbc.saveMatrixToDatabase_leaf_v2(img,bs,'static/output',sorted_data,lbl,labelname=os.path.basename(datasetPath).split('.')[0]+'closed_composite') print('saved composite image in database!!') output='static/output' filename='closed_composite.png' img.save(output+'/'+filename) ''' ''' #CODE FOR COMPOSITE IMAGE VISUALIZATION (1-d) #img,bs,matrix=hd.generateHeidiMatrixResults_kd(output,filtered_data,1,10) #1 is image type which means 1-d, 2: 2-d ... #lbl=rg.regionLabelling_8(matrix) #img,dict1=hd.generateHeidiMatrixResults_noorder_helper(matrix,bs,output,sorted_data,'legend_composite') #dbc.deleteAllNodes(labelname=os.path.basename(datasetPath).split('.')[0]+'_composite') #dbc.saveMatrixToDatabase_leaf_v2(img,bs,'static/output',sorted_data,lbl,labelname=os.path.basename(datasetPath).split('.')[0]+'_composite') #dbc.saveColorToDatabase(dict1,os.path.basename(datasetPath).split('.')[0]+'_composite') #print('saved composite image in database!!') ''' #4-JUNE #loading heidi image #3sep pixels = dbc.databasefilter( labelname=os.path.basename(datasetPath).split('.')[0] + imgType, color='ALL') width, height, scale, class_count, class_label = dbc.getImageParams( os.path.basename(datasetPath)) class_count = class_count.split(',') perclustercount = [int(i) for i in class_count] class_label = class_label.split(',') class_label = [int(i) for i in class_label] #print('pppp1',width,height,scale) color_dict = dbc.getColorFromTopLegend(os.path.basename(datasetPath)) #print(color_dict) img = dbc.drawImage(pixels, width, height, scale, perclustercount, class_label, color_dict, grid=grid) print(os.path.basename(datasetPath)) dbc.updateImageInfo( img.size[0], img.size[1], os.path.basename(datasetPath)) #LEGEND SPACING AND OTHER STUFF output = 'static/output' filename = 'consolidated_img.png' img.save(output + '/' + filename) #3sep return json.dumps({'output': str("123"), 'subspace': str("123")})
def createCompositeHeidi_v1(inputData, subspaceDict, knn=knn): print('createCompositeHeidi:', subspaceDict) bit_subspace = {} row = inputData.shape[0] heidi_matrix = np.zeros(shape=(row, row), dtype=np.uint64) factor = 1 for color in subspaceDict: print(color) #1. GET SORTED DATA FOR EACH COLOR allsubspace = [] for subspace in subspaceDict[color]: allsubspace = allsubspace + subspace allsubspace = list(set(allsubspace)) #print(allsubspace,len(allsubspace)) if len(allsubspace) == 1: param = {} param['columns'] = allsubspace param['order'] = [True for i in param['columns']] ordering = 'dimension' else: param = {} #ordering='pca_ordering' ordering = 'euclidian_distance' #ordering='mst_distance' filtered_data = inputData[allsubspace + ['classLabel']] filtered_data['classLabel_orig'] = filtered_data['classLabel'].values sorted_data = op.sortbasedOnclassLabel(filtered_data, ordering, param) #print(allsubspace,sorted_data) #2. GENERATING HEIDI MATRIX FOR EACH COLOR hm = np.zeros(shape=(row, row), dtype=np.uint64) c = 0 for subspace in subspaceDict[color]: filtered_data = sorted_data[subspace] subspace = filtered_data np_subspace = subspace.values #NEED TO CHANGE IF COL IS A LIST #print(np_subspace.shape) nbrs = NearestNeighbors(n_neighbors=knn, algorithm='ball_tree').fit(np_subspace) temp = nbrs.kneighbors_graph(np_subspace).toarray() temp = temp.astype(np.uint64) if c == 0: hm = hm | temp else: hm = hm & temp #print(hm,factor*hm) heidi_matrix = heidi_matrix + factor * hm bit_subspace[factor] = color #subspaceDict[color]#color factor = factor * 2 #print(factor,allsubspace) #print('-----GENERATEiMAGE : generateHeidiImage ------') print(bit_subspace, subspaceDict) arr = np.zeros((hm.shape[0], hm.shape[1], 3)) for i in range(hm.shape[0]): for j in range(hm.shape[1]): if hm[i][j] in bit_subspace.keys(): arr[i][j] = list(wb.hex_to_rgb(color)) else: arr[i][j] = [255, 255, 255] # DEBUG IMAGE, ORDEING OF POINTS ''' tmp=arr.astype(np.uint8) img_top100 = Image.fromarray(tmp) img_top100.save('temp'+str(factor)+'.png') ''' print('-----GENERATEiMAGE : generateHeidiImage ------') #color_palette = sns.color_palette("cubehelix", 100) color_palette = sns.color_palette("cubehelix", 200) color_palette = [(int(a * 255), int(b * 255), int(c * 255)) for (a, b, c) in color_palette] arr = np.zeros((heidi_matrix.shape[0], heidi_matrix.shape[1], 3)) count = 0 print(bit_subspace) val_color_map = {} for i in range(heidi_matrix.shape[0]): for j in range(heidi_matrix.shape[1]): if heidi_matrix[i][j] in bit_subspace.keys(): arr[i][j] = list( wb.hex_to_rgb(bit_subspace[heidi_matrix[i][j]])) elif heidi_matrix[i][j] in val_color_map.keys(): arr[i][j] = val_color_map[heidi_matrix[i][j]] elif (heidi_matrix[i][j] != 0): t = list(color_palette[0]) #t=list(color_palette[count]) #arr[i][j]=t #count+=1 #val_color_map[heidi_matrix[i][j]]=t #if(count>100): break else: arr[i][j] = [255, 255, 255] #if(heidi_matrix[i][j]==0): arr[i][j]=[0,0,0] #else: arr[i][j]=[255,255,255] tmp = arr.astype(np.uint8) img_top100 = Image.fromarray(tmp) img_top100.save('cmp' + str(factor) + '.png') #img_top100.save('temp.png') #hh.getMappingDict(heidi_matrix,); return img_top100, heidi_matrix
def createCompositeHeidi(inputData, subspaceDict, knn=knn): print('----createCompositeHeidi----') bit_subspace = {} row = inputData.shape[0] heidi_matrix = np.zeros(shape=(row, row), dtype=np.uint64) factor = 1 f = 0 for color in subspaceDict: print(color) #1. GET SORTED DATA FOR EACH COLOR allsubspace = [] for subspace in subspaceDict[color]: allsubspace = allsubspace + subspace allsubspace = list(set(allsubspace)) #print(allsubspace,len(allsubspace)) if len(allsubspace) == 1: param = {} param['columns'] = allsubspace param['order'] = [True for i in param['columns']] ordering = 'dimension' else: param = {} #ordering='pca_ordering' #ordering='euclidian_distance' ordering = 'mst_distance' filtered_data = inputData[allsubspace + ['classLabel']] filtered_data['classLabel_orig'] = filtered_data['classLabel'].values sorted_data = op.sortbasedOnclassLabel(filtered_data, ordering, param) print(sorted_data.shape) hm = np.zeros(shape=(row, row), dtype=np.uint64) c = 0 for subspace in subspaceDict[color]: filtered_data = sorted_data[subspace] subspace = filtered_data np_subspace = subspace.values #NEED TO CHANGE IF COL IS A LIST #print(np_subspace.shape) nbrs = NearestNeighbors(n_neighbors=knn, algorithm='ball_tree').fit(np_subspace) temp = nbrs.kneighbors_graph(np_subspace).toarray() temp = temp.astype(np.uint64) if c == 0: hm = hm | temp else: hm = hm & temp #print(hm,factor*hm) heidi_matrix = heidi_matrix + factor * hm bit_subspace[f] = color #subspaceDict[color]#color f = f + 1 #bit_subspace[factor]=color#subspaceDict[color]#color factor = factor * 2 #if(color=='#7092ec'): break t = np.unique(heidi_matrix) #t=[bin(i) for i in t] comp_dict = {} for k in range(len(t)): bin_value = bin(t[k])[::-1] subspace_col = [ index for index, value in enumerate(bin_value) if value == '1' ] val = [] for x in subspace_col: val = val + [bit_subspace[x]] import itertools val.sort() comp_dict[t[k]] = list(val for val, _ in itertools.groupby(val)) #print(t[k],bin(t[k]),subspace_col,val) import webcolors as wb arr = np.zeros((heidi_matrix.shape[0], heidi_matrix.shape[1], 3)) #color_map={} #color_rev_map={} #new_color_map={} for i in range(heidi_matrix.shape[0]): for j in range(heidi_matrix.shape[1]): x = comp_dict[heidi_matrix[i][j]] if len(x) == 1: arr[i][j] = list(wb.hex_to_rgb(x[0])) elif (len(x) != 0): #print(x) x = [ list(wb.hex_to_rgb(x)) for x in comp_dict[heidi_matrix[i][j]] ] new_color = tuple( [int(sum(row[i] for row in x) / len(x)) for i in range(3)]) arr[i][j] = list(new_color) #if not new_color in new_color_map: new_color_map[wb.rgb_to_hex(new_color)]=1 #else: # print('else called') # new_color_map[wb.rgb_to_hex(new_color)]=new_color_map[wb.rgb_to_hex(new_color)]+1 #color_map[wb.rgb_to_hex(new_color)]=comp_dict[heidi_matrix[i][j]] #for k in comp_dict[heidi_matrix[i][j]]: # if not k in color_rev_map: # color_rev_map[k]=set([wb.rgb_to_hex(new_color)]) # else: # color_rev_map[k]=color_rev_map[k].union([wb.rgb_to_hex(new_color)]) else: arr[i][j] = [255, 255, 255] tmp = arr.astype(np.uint8) img_top100 = Image.fromarray(tmp) img_top100.save('cmp.png') return img_top100, heidi_matrix
def generateHeidiMatrixResults_kd(outputPath, inputData, k, knn=knn): global global_count, global_map_dict #hh.create_empty_folder(outputPath) global_count = 0 factor = 1 bit_subspace = {} row = inputData.shape[0] count = 0 print('hello', k) heidi_matrix = np.zeros(shape=(row, row), dtype=np.uint64) allsubspaces = get_all_kd_subspaces(k, inputData.shape[1] - 1) print('allsubspaces', allsubspaces) frmt = str(inputData.shape[1] - 1) + 'b' factor = 1 bit_subspace = {} count = 0 print('knn:', knn) #for col in range(0,inputData.shape[1]-1): #hh.create_empty_folder(outputPath+'/t1') for i in allsubspaces: bin_value = str(format(i, frmt)) bin_value = bin_value[::-1] subspace_col = [ index for index, value in enumerate(bin_value) if value == '1' ] filtered_data = inputData.iloc[:, subspace_col + [-1]] #NEED TO CHANGE IF COL IS A LIST filtered_data['classLabel_orig'] = filtered_data['classLabel'].values #param={} #param['columns']=list(filtered_data.columns[:-1]) #param['order']=[True for i in param['columns']] if k == 1: param = {} param['columns'] = list(filtered_data.columns[:-1]) param['order'] = [True for i in param['columns']] ordering = 'dimension' else: param = {} ordering = 'mst_distance' sorted_data = op.sortbasedOnclassLabel(filtered_data, ordering, param) subspace = sorted_data.iloc[:, :-2] np_subspace = subspace.values #NEED TO CHANGE IF COL IS A LIST #print(np_subspace.shape) nbrs = NearestNeighbors(n_neighbors=knn, algorithm='ball_tree').fit(np_subspace) temp = nbrs.kneighbors_graph(np_subspace).toarray() temp = temp.astype(np.uint64) heidi_matrix = heidi_matrix + temp * factor temp = temp * factor factor = factor * 2 #bit_subspace[count]=subspace_col subspace_col_name = [inputData.columns[i] for i in subspace_col] print(subspace_col_name) bit_subspace[count] = subspace_col_name count += 1 #map_dict,all_info=hh.getMappingDict(temp,bit_subspace,count-1) #hh.createLegend(map_dict,all_info,outputPath+'/t1/legend'+str(count)+'.html') #img,imgarray=hh.generateHeidiImage(temp,map_dict) #hh.saveHeidiImage(img,outputPath,'/t1/img_bea'+str(count)+'.png') #array=sorted_data['classLabel'].values #algo1_bar,t=hh.createBar(array) #hh.visualizeConsolidatedImage(imgarray,algo1_bar,outputPath+'/t1/consolidated_img'+str(count)+'.png') #count=0 map_dict, all_info = hh.getMappingDict(heidi_matrix, bit_subspace, count) hh.createLegend(map_dict, all_info, outputPath + '/legend.html') img, imgarray = hh.generateHeidiImage(heidi_matrix, map_dict) hh.saveHeidiImage(img, outputPath, 'img_bea.png') array = sorted_data['classLabel'].values print(array) algo1_bar, t = hh.createBar(array) hh.visualizeConsolidatedImage(imgarray, algo1_bar, outputPath + '/consolidated_img.png') print('visualized consolidated image') return img, bit_subspace, heidi_matrix