I am visualizing a network of related peptide sequences in Cytoscape. The amino acid sequence is split into columns (i.e. Col1: amino acid 1, Col2, amino acid 2, Col3: amino acid 3, etc), and I want to color the background of the cell in the table based on the amino acid type (i.e. aromatic F,Y,W = color1, basic H,K,R = color2, acidic D,E = color3, etc.) so that I can quickly see amino acids that share chemical properties. I can do this manually through the 'Table' tab in the style window by setting the Cell Background Paint and discretely mapping each amino acid to a color for each column, but this is quite laborious (see image below).
In short, I want help to do all this 'Table' style formatting at once in an automated fashion.
Screenshot of cytoscape 'Table' style window
My attempts to address this issue have failed: (1) The 'Table' tab style cannot be exported so I can't set the color scheme and then import it to other cytoscape networks. (2) The developers of py4cytoscape did not include options for setting the 'Table' tab styles (only for Node, Edge, and Network styles). (3) The only mention of 'Cell Background Paint' in any kind of scripting context is in documentation for Cytoscape App Developers or API specification for Cytoscape using a Java Swing front-end which is a little too complicated for me currently so I would like help in finding a way to quickly set the Table style in an automated way.
Related
A customer requested me a software, and one of its requirements is build a form and fill it with data collected from database.
This form is currently being created in Excel. It uses cells to build the form, some cells have blank background, others blank background with black bottom border (to look like a line where text is typed), others have gray background with white text, and there's also a logo image. In Excel, some cells are merged to become bigger than other cells. They fill the text in another spreadsheet and the required cells in the form take that text and format it.
I've looked many report frameworks in Java, some are very complex and some look like Excel's graph builders, but I saw none that can make a complex 2D form like this.
Data filled in it is simple, like name, quantity, some numbers, but they have different length requiring for example that name's cell to be merged to cover a full horizontal line, and some have smaller font size. There's no repeated data that would require sorting and I have no problem gathering the data.
In the end, the filled form must also be printed, so I can't use normal Swing table or grid. It will be used in Windows now, but it'd be nice to support Linux printing too.
Any suggestion of a Java component that builds a 2D layout like this and fills it with strings will be very much appreciated. I even thought of taking a screenshot of their current form and just use 2D Graphics to print the text, but I'd not be able to print it.
This is an example of the kind of form I must build, it's somewhat like that but some areas have gray background with white text:
No, it's not a duplicate, but it is a good example of the layout.
If I have an image of a table of boxes, with some coloured in, is there an image processing library that can help me turn this into an array?
Thanks
You can use a thresholding function to binarize the image into dark/light pixels so dark pixels are 0 and light ones are 1.
Then you would want to remove image artifacts using dilation and erosion functions to remove noise (all these are well defined on Wikipedia).
Finally if you know where the boxes are, you can just get the value in the center of each box to determine the array value, or possibly use an area near the center and take the prevailing value (i.e. more 0's is a filled in square, more 1's is and empty square).
If you are scanning these boxes and there is a lot of variation in the position of the boxes, you will have to perform some level of image registration using known points, or fiducials.
As far as what tools to use to do this, I'd recommend first trying this manually using a tool like ImageJ, which has a UI and can also be used programatically since it is written all in Java.
Other good libraries for this include OpenCV and the Java Advanced Imaging API.
Your results will definitely vary depending on the input images and how consistenly lit and positioned they are.
The best way to see how it will do for your data is to try applying these processing steps manually to see where your threshold value should be, how much dilating/eroding you need to get consistent results.
here's what we have today:
* NxM grid of points in 3D
* we draw these using legacy opengl calls.
* we have a rubberband select and single point selection, using selection buffer.
Today we can use CTRL to select parts of what we want to select until we have the selection we want. but it is getting very annoying if you have a 200x500 grid and want to select a circle, star or anythingn that is not a rectangle.
I've tried to find any info on how to create a lasso selection, some people uses unique colors for each object and then uses readpixel to see what was sselected. We can't use this because all of our points needs to be the same color.
There's a pretty good illustrated tutorial on color picking at Lighthouse3D.com:
http://www.lighthouse3d.com/opengl/picking/index.php?color1
Its quite fast & I have implemented this technique in apps with millions of polygons. Way faster than bounding boxes since you only check what's under the cursor (or lasso region). Also, it's compatible with OpenGL ES as the feedback buffer selection is on its way out.
So I am developing a very simple app, mostly for personal use, am am looking for a simple solution to a simple problem.
In its simplest form I am looking for a way to have a line of text with just one or two words blurred out. Basically I am looking to blur text beyond readability but still hinting at what is hidden. Kind of a knowledge / memory app to help memorize some definitions by prompting with a few key words.
I am having issues finding a simple way to accomplish this. Am I just missing an attribute to blur text?
I have thought about:
overriding say the textview onDraw but that seems overkill and I am unsure if there are any methods available to easily blur text.
using the toHtml and trying out the new CSS3 blur effects but I don't think that that is a reasonable solution and I am not sure that the Android platform supports all the CSS3 format, if any.
the simplest and most desirable solution in my book was to find a font (ttf, off, etc) file, derived from a common font, that is already blurred as I described, and use that alternating with the non blurred version of that font to achieve the desired effect.
make the described font but that just plain requires too much time on my part and the outcome is not necessarily good :)
I have thought about some alternative ways to simulate this effect but they all result in fading the text, which is undesirable, since I want to have some visual prompts to indicate the obscured texts length.
Any ideas? It's been years since I have developed in Java and I am unsure what is available and what the Android OS supports.
I haven't looked into using these properties for only part of the text, but TextView has some possibly useful properties related to text shadows. Using something like the following XML attributes, you could hide the actual text and just show a blurred shadow.
android:textColor - #0000 (fully transparent so that the crisp text is not shown)
android:shadowColor - #FFFF (or whatever color you want to appear)
android:shadowDx - 0 (the shadow is in the same horizontal position as the text)
android:shadowDy - 0 (the shadow is in the same vertical position as the text)
android:shadowRadius - Depends on how much you want to blur. A very small non-zero value, such as 0.001, will be sharp. Larger values blur more, and at some point the shadow becomes illegible.
I have been struggling to get the images displayed in an SWT TableItem to scale. I have a listener which scales the fonts correctly, and I have confirmed that the images being set into the TableItem are correctly scaled. I know that the scaled images are being successfully set into the TableItem, because I can even change what image gets displayed. But the new image is always displayed at the original scale.
I have read in SWT: The Standard Widget Toolkit, Volume 1 where the authors state:
The First Image Defines the Size of
All Images in the Control
Due to a Windows limitation, just like
ToolBar, TabFolder, and Tree, Table
scales the images it displays to be
the size of the first image inserted
into the control.
The behaviour I'm seeing is the most extreme case suggested by this quote -- images in the table seem to be being scaled, not the the size of the first image in the table, but to the size of the first image ever to have been in the table. Can anyone confirm or refute this? Does anyone have any more detailed information about the behaviour of images in TableItems? Is this restriction really the show-stopper it seems to be?
And in particular, if I go down the path of custom drawing table items (Custom Drawing Table and Tree Items), am I likely to bump into any further showstoppers?
(You'll note what a good job I'm doing of gritting my teeth and not giving way to rage at having to deal with Windows stupidity even when using a supposedly cross-platform development environment!)
I can confirm this in my experience on Windows.
I propose one of two solutions:
Use custom table drawing as per the link you mentioned. It's a little annoying but not more than 2 hours of work I'd say to learn and implement it.
Use an alternative SWT table control e.g. Nebula Grid or KTable which do not share the same platform limitations of Table on Windows
Edit: in response to "And in particular, if I go down the path of custom drawing table items (Custom Drawing Table and Tree Items), am I likely to bump into any further showstoppers?"
The only issue I found with custom drawing is that it's best to know ahead of time what the maximum row height will be, otherwise there will be jumping when Table has to increase the row height and therefore scroll items a bit while it readjusts