def createBasisViewer(basisDirectory, htmlPath, Reducer, QLSA): try: os.mkdir(basisDirectory) except: print "Error Creating folder" return Control.imageViewGenerator( Reducer.reduction.basisM.max(), Reducer.reduction.basisM.min(), basisDirectory, htmlPath, 19, True, QLSA )
def createReconstructionViewer(imagesDirectory, htmlPath, Reducer, QLSA): try: os.mkdir(imagesDirectory) except: print "Error Creating folder" return Control.imageViewGenerator( Reducer.reduction.reconstructed.max(), Reducer.reduction.reconstructed.min(), imagesDirectory, htmlPath, 19, True, QLSA, )
import Control I = '/home/tuareg/Documents/UNAL/7mo semestre/Machine Learning 2/TMP/datasets/ORLFull' M,L = Control.imagesMatrix(I) M = Control.quantumNormalize(M) quantumImagesDirectory = '/home/tuareg/Documents/UNAL/7mo semestre/Machine Learning 2/TMP/datasets/ORLFullQuantumNormalized/' imageGenerator = Control.imageViewGenerator(M.max(),M.min(),quantumImagesDirectory,quantumImagesDirectory,112,True) for i in range(M.shape[1]): imageGenerator.toImage(M[:,i],L[i])
import nibabel as nib import Control img = nib.load("../../../datasets/oasis/OAS1_0227_MR1_mpr_n4_anon_111_t88_masked_gfc.hdr").get_data()[:,:,:,0] imagesDirectory = "./" height =176 index = 100 im = img[:,100,:] imgViewer = Control.imageViewGenerator(im.max(),0,imagesDirectory,imagesDirectory,height,False) imgViewer.toImage(im.reshape(1,-1),"f"+str(index))