public void Load(Dictionary <string, HashSet <object> > valuerange) { this.images = Viewer.images; this.arguments = Global.arguments; // Create track bars for each argument trackbars.Clear(); int argidx = -1; foreach (Cinema.CinemaArgument argument in arguments) { ++argidx; /*if(argument.values.Length <= 1) * continue;*/ TrackBar newtrackbar = new TrackBar(argument, argidx, meshBorders, meshTick, meshSelection); newtrackbar.label = argument.label; trackbars.Add(newtrackbar); } /*// Create track bars for meta data value * foreach(KeyValuePair<string, HashSet<object>> range in valuerange) * { * TrackBar newtrackbar = new TrackBar(range.Value.Count, meshSelection); * newtrackbar.label = range.Key; * trackbars.Add(newtrackbar); * }*/ }
public void Load(Dictionary<string, HashSet<object>> valuerange) { this.images = Viewer.images; this.arguments = Global.arguments; // Create track bars for each argument trackbars.Clear(); int argidx = -1; foreach(Cinema.CinemaArgument argument in arguments) { ++argidx; /*if(argument.values.Length <= 1) continue;*/ TrackBar newtrackbar = new TrackBar(argument, argidx, meshBorders, meshTick, meshSelection); newtrackbar.label = argument.label; trackbars.Add(newtrackbar); } /*// Create track bars for meta data value foreach(KeyValuePair<string, HashSet<object>> range in valuerange) { TrackBar newtrackbar = new TrackBar(range.Value.Count, meshSelection); newtrackbar.label = range.Key; trackbars.Add(newtrackbar); }*/ }
public void Unload() { if(colorTableMgr != null) colorTableMgr.Visible = false; if(texstream != null) texstream.ClearImages(); if(images != null) { foreach(TransformedImage image in images) image.Dispose(); images = null; } arguments = null; selectionAabb = null; sdr2D_default = sdr2D_cm = null; sdr3D_default = sdr3D_cm = null; if(mesh3D != null) mesh3D.Free(); mesh3D = null; #if USE_ARG_IDX argIndex.Unload(); #endif #if USE_PARAM_IDX paramIndex.Unload(); #endif #if USE_CUSTOM_CONTROLS ccContainer.Unload(); #endif }
public void Load(IEnumerable<TransformedImage> newimages, Dictionary<string, HashSet<object>> valuerange, Size imageSize, bool floatimages = false, bool depthimages = false) { //depthimages = false; int i; this.images = Viewer.images; this.arguments = Global.arguments; if(floatimages) { colorTableMgr.Visible = true; colorTableMgr.OnSizeChanged(backbuffersize); colorTableMgr.Reset(); //foreach(TransformedImage newimage in newimages) // newimage.isFloatImage = true; } else { //foreach(TransformedImage newimage in newimages) // newimage.isFloatImage = false; } if(sdr2D_default == null) { #if USE_GS_QUAD sdr2D_default = new RenderShader(new string[] {IMAGE_CLOUD_SHADER.VS_USING_GS}, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_DEFAULT_DECODER}, new string[] {IMAGE_CLOUD_SHADER.GS}); sdr2D_cm = new RenderShader(new string[] {IMAGE_CLOUD_SHADER.VS_USING_GS}, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_COLORTABLE_DECODER}, new string[] {IMAGE_CLOUD_SHADER.GS}); sdr2D_assemble = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_USING_GS }, new string[] {IMAGE_CLOUD_SHADER.FS_ASSEMBLE_IMAGE}, new string[] {IMAGE_CLOUD_SHADER.GS})); #else sdr2D_default = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEFAULT }, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_DEFAULT_DECODER}); sdr2D_cm = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEFAULT }, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_COLORTABLE_DECODER}); sdr2D_assemble = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEFAULT }, new string[] {IMAGE_CLOUD_SHADER.FS_DEPTH_PEELING}); #endif sdr3D_default = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEPTHIMAGE }, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_DEFAULT_DECODER}); sdr3D_cm = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEPTHIMAGE }, new string[] {IMAGE_CLOUD_SHADER.FS, IMAGE_CLOUD_SHADER.FS_COLORTABLE_DECODER}); sdr3D_assemble = new RenderShader(new string[] { IMAGE_CLOUD_SHADER.VS_DEPTHIMAGE }, new string[] {IMAGE_CLOUD_SHADER.FS_DEPTH_PEELING}); foreach(GLShader sdr in new GLShader[] {sdr2D_cm, sdr3D_cm, sdr2D_assemble, sdr3D_assemble}) { sdr.Bind(); GL.ActiveTexture(TextureUnit.Texture4); colorTableMgr.Colormap.Bind(); GL.Uniform1(sdr.GetUniformLocation("Colormap"), 4); } GL.ActiveTexture(TextureUnit.Texture0); } texstream.AddImages(newimages); if(depthimages && mesh3D == null) { // Create mesh for depth rendering Size depthimagesize = new Size(imageSize.Width, imageSize.Height); Vector3[] positions = new Vector3[depthimagesize.Width * depthimagesize.Height]; Vector2[] texcoords = new Vector2[depthimagesize.Width * depthimagesize.Height]; i = 0; for(int y = 0; y < depthimagesize.Height; ++y) for(int x = 0; x < depthimagesize.Width; ++x) { positions[i] = new Vector3(2.0f * (float)x / (float)(depthimagesize.Width - 1) - 1.0f, 2.0f * (float)y / (float)(depthimagesize.Height - 1) - 1.0f, 1.0f); texcoords[i] = new Vector2((float)x / (float)(depthimagesize.Width - 1), 1.0f - (float)y / (float)(depthimagesize.Height - 1)); ++i; } /*int[] indices = new int[6 * (depthimagesize.Width - 1) * (depthimagesize.Height - 1)]; i = 0; for(int y = 1; y < depthimagesize.Height; ++y) for(int x = 1; x < depthimagesize.Width; ++x) { indices[i++] = (x - 1) + depthimagesize.Width * (y - 1); indices[i++] = (x - 0) + depthimagesize.Width * (y - 1); indices[i++] = (x - 1) + depthimagesize.Width * (y - 0); indices[i++] = (x - 1) + depthimagesize.Width * (y - 0); indices[i++] = (x - 0) + depthimagesize.Width * (y - 1); indices[i++] = (x - 0) + depthimagesize.Width * (y - 0); } mesh3D = new GLMesh(positions, null, null, null, texcoords, indices);*/ mesh3D = new GLMesh(positions, null, null, null, texcoords, null, PrimitiveType.Points); //GL.PointSize(2.0f); } int argIndexBottom = 0; #if USE_ARG_IDX argIndex.Load(valuerange); argIndexBottom = argIndex.Bounds.Bottom + arguments.Length * argIndex.Bounds.Height * 3 / 2; #endif #if USE_PARAM_IDX paramIndex.Bounds = new Rectangle(paramIndex.Bounds.X, argIndexBottom, paramIndex.Bounds.Width, paramIndex.Bounds.Height);// paramIndex.Bounds.Y = argIndexBottom; paramIndex.Load(); #endif // Enable depth rendering by default whenever a new scene is loaded depthRenderingEnabled = true; depthRenderingEnabled_fade = 1.0f; depthRenderingEnabled = false; depthRenderingEnabled_fade = 0.0f; }
public void Unload() { images = null; arguments = null; trackbars.Clear(); }
public Selection(TransformedImageCollection images) { this.images = images; this.selection = new HashSet <TransformedImage>(); }