CPT += 1 if "RHEINBERG" == MethodUsed: StackRGB[:,:,int((Z+1200)/80),0] = SumHoloR StackRGB[:,:,int((Z+1200)/80),1] = SumHoloG StackRGB[:,:,int((Z+1200)/80),2] = SumHoloB else : Stack[:,:,int((Z+1200)/80)] = SumHolo CPTSUM += 1 print(f"Slice {CPTSUM} out of {Stack.shape[2]}") print(f"Pre-Processing time for {CPTSUM} Slices: " f"{np.round(time.time() - start_time,decimals=2)} seconds") if "RHEINBERG" == MethodUsed: ft.SAVtiffRGBCube(f"{PROCESSINGFOLDER}/{MethodUsed}_{2*dimHolo}x{2*dimHolo}x{StackRGB.shape[2]}.tiff", StackRGB, 2*M.PIX*1e6) else: ft.SAVtiffCube(f"{PROCESSINGFOLDER}/{MethodUsed}_{2*dimHolo}x{2*dimHolo}x{Stack.shape[2]}.tiff", Stack, 2*M.PIX*1e6) # Center recording and file closing fidParams.write(f"nb_angle {CPT_EXIST-1}\n") fidParams.write(f"fmaxHolo {fmaxHolo}\n") fidParams.write(f"dimHolo {dimHolo}\n") fidParams.write(f"pixTheo {M.PIX/Gtot}\n") tf.imwrite(CHEMINSAV_CENTRES, np.float32(np.int32(Centres))) fidCentrestxt.close() fidParams.close()
print("----------------------------------") start_time = time.time() UBornCplxR, UBornCplxG, UBornCplxB = rp.RheinbergIllumination( Refraction + 1j * Absorption, [30, 120], 60, [70, 250]) IntensiteRhein = np.zeros((DIMTOMO, DIMTOMO, DIMTOMO, 3)) IntensiteRhein[:, :, :, 0] = np.abs(UBornCplxR)**2 IntensiteRhein[:, :, :, 1] = np.abs(UBornCplxG)**2 IntensiteRhein[:, :, :, 2] = np.abs(UBornCplxB)**2 print( f"Rheinberg Contrast processing time: {np.round(time.time() - start_time,decimals=2)} seconds" ) del UBornCplxR, UBornCplxG, UBornCplxB start_time = time.time() ft.SAVtiffRGBCube( f"{PROCESSINGFOLDER}/IntensiteRheinSpec_{DIMTOMO}x{DIMTOMO}x{DIMTOMO}.tiff", IntensiteRhein, 2 * PIXTHEO * 1e6) print( f"Data saving: {np.round(time.time() - start_time,decimals=2)} seconds" ) # Darkfield processing if "DARKFIELD" == MethodUsed: DarkF = abs(UBornCplxDark)**2 start_time = time.time() ft.SAVtiffCube( f"{PROCESSINGFOLDER}/Darkfield_{DIMTOMO}x{DIMTOMO}x{DIMTOMO}.tiff", DarkF, 2 * PIXTHEO * 1e6) print( f"Data saving: {np.round(time.time() - start_time,decimals=2)} seconds" )
) print("") RefractionB = f_reconB.real AbsorptionB = f_reconB.imag OTFB = np.zeros_like(mask_sum) OTFB[mask_sum != 0] = 1 IntensiteB = np.abs(RefractionB + 1j * AbsorptionB)**2 IntensiteRhein[:, :, :, 2] = IntensiteB OTFRhein[:, :, :, 2] = OTFB del RefractionB, AbsorptionB, OTFB, IntensiteB # Writting results start_time = time.time() ft.SAVtiffRGBCube( f"{PROCESSINGFOLDER}/Rheinberg_{DIMTOMO}x{DIMTOMO}x{DIMTOMO}.tiff", IntensiteRhein, 2 * PIXTHEO * 1e6) ft.SAVtiffRGBCube( f"{PROCESSINGFOLDER}/OTFRheinberg_{DIMTOMO}x{DIMTOMO}x{DIMTOMO}.tiff", OTFRhein, 1. / (OTFRhein.shape[0] * 2 * PIXTHEO * 1e6)) print(f"Data saving: {np.round(time.time() - start_time,decimals=2)} seconds") viewer = napari.view_image(IntensiteRhein[:, :, :, 2].transpose(-1, 1, 0), name='Bleu', colormap='blue') viewer.add_image(IntensiteRhein[:, :, :, 1].transpose(-1, 1, 0), name='Rouge', colormap='red') viewer.add_image(IntensiteRhein[:, :, :, 0].transpose(-1, 1, 0), name='Vert', colormap='green')