WPF Tree Diagram Library? - wpf

Is there any reliable and free WPF library to create simple tree diagrams dynamically? I mean, all I want is something that would allow me to do that kind of pseudo-code:
Item item1 = new Item("Level 1");
Item item11 = new Item("Level 1.1");
Item item12 = new Item("Level 1.2");
Item item111 = new Item("Level 1.1.1");
item11.AddChild(item111);
item1.AddChild(item11);
item1.AddChild(item12);
And then to generate automatically the correspoding diagram:
Thank you.

I found this diagram solution and tinkered a bit in order to adapt it to my needs.
I'm kinda surprised there's no library to do so. Still looking for it :)

I've found this one pretty easy to use:
https://www.codeproject.com/Articles/29518/A-Graph-Tree-Drawing-Control-for-WPF
You can find an example how to use it in the downloaded zip file here:
SilverTreeContainer.zip\TreeContainer\TreeContainerTest\winTreeContainerTest.xaml
Later, I also found this article interesting:
How to easily draw graphs in WPF?
This is for Graph drawing in general, not specialized for Trees; but I've found the above link here as well (top rated answer, option 6)

Related

GradCam Implementation in TFJS

I'm trying to implement GradCam (https://arxiv.org/pdf/1610.02391.pdf) in tfjs, based on the following Keras Tutorial (http://www.hackevolve.com/where-cnn-is-looking-grad-cam/) and a simple image classification demo from tfjs, similar to (https://github.com/tensorflow/tfjs-examples/blob/master/webcam-transfer-learning/index.js) with a simple dense, fully-connected layer at the end.
However, I'm not able to retrieve the gradients needed for the gradcam computation. I tried different ways to retrieve gradients for the last sequential layer, but did not succeed, as types of tf.LayerVariable from the respective layer is not convertible to the respective type of tf.grads or tf.layerGrads.
Did anybody already succeeded to get the gradients from sequential layer to a tf.function like object?
I'm not aware of the ins and outs of the implementation, but I think something along the lines of this: http://jlin.xyz/advis/ is what you're looking for?
Source code is available here: https://github.com/jaxball/advis.js (not mine!)
This official example in the tfjs-examples repo should be close to, if not exactly, what you want:
https://github.com/tensorflow/tfjs-examples/blob/master/visualize-convnet/cam.js#L49

How to use arrays/lists and loops in Python

Ok so this is my first question here. I am currently an IT student and I am taking a fundamentals of programming class. I seem to be spending more time lost and confused than I feel as if I should. We are using Python as the programming language. The topic for this week is arrays and lists. From what I have gathered through reading many other forums, Python does not use array but lists. Therefore the assignment does not make since to me. Any help or guidance would be greatly appreciated.
Create a FLOWCHART and a STORYBOARD for each problem.
Use the information below to create a storyboard (which can be a text based description for solving the problems) and a flowchart (using flowchart symbols to illustrate how you would program) to solve each problem. You may use Microsoft Word® for your Storyboard and Microsoft PowerPoint® for your flowchart.
Problem 1: Create an array that contains the days of the week.
Problem 2: Create a loop to print the content above.
So what would the flowchart for this look like? The assignment next week builds on this by actually writing the program in Python. What would the script look like? Thanks for any help.
This is just for hinting, I won't write your program for you. In your comment, you assigned to the list (you're right, they're not called "arrays" in Python) correctly. Now you need to iterate over it to print each item individually. I'd suggest you refresh your memory in the Python Tutorial on how to control program flow, especially the for statement. Remember, the general idea is:
for item in collection_of_items:
do_something_with(item)
days = ['monday','tuesday','wednessday','thursday','friday','saturday','sunday']
for day in days:
print(day)
Edit:
what would the flowchart for this look like?
This problem is quite simple, try to make your own flowchart. Try to practice thinking at the very first lesson of programming course.
What would the script look like?
It would look like above code. But you can do it better and more professional, try to figure it out.

Representing images as graphs based on pixels using OpenCV's CvGraph

Need to use c for a project and i saw this screenshot in a pdf which gave me the idea
http://i983.photobucket.com/albums/ae313/edmoney777/Screenshotfrom2013-11-10015540_zps3f09b5aa.png
It say's you can treat each pixel of an image as a graph node(or vertex i guess) so i was wondering how
i would do this using OpenCV and the CvGraph set of functions. Im trying to do this to learn about and how
to use graphs in computer vision and i think this would be a good starting point.
I know i can add a vetex to a graph with
int cvGraphAddVtx(CvGraph* graph, const CvGraphVtx* vtx=NULL, CvGraphVtx** inserted_vtx=NULL )
and the documentation says for the above functions vtx parameter
"Optional input argument used to initialize the added vertex (only user-defined fields beyond sizeof(CvGraphVtx) are copied)"
is this how i would represent a pixel as a graph vertex or am i barking up the wrong tree...I would love to learn more about
graphs so if someone could help me by maybe posting code, links, or good ol' fashioned advice...Id be grateful=)
http://vision.csd.uwo.ca/code has an implementation on Mulit-label optimization. GCoptimization.cpp file has a GCoptimizationGridGraph class, which I guess is what you need. I am not a C++ expert, so can't still figure out how it works. I am also looking for some simpler solution.

Using implementation of sift by A Vedaldi

first of all i should say i'm not very good in english so i hope you can get my point!
does any body works with A Vedaldi implementation of sift? my final project in university is about object recognition and i have to work with sift... i use A Vedaldi implementation and i can find features and descriptors for similar images...but i don't know how to find best features from for example 10 images and build a data base for a special object to be recognized later... plz help me :(
I have worked with Vedaldi's SIFT. I used to choose SIFT features at the edges or better at the corners of the image.
I find edges with canny, and corners with Harris detector. Then I keep points with a high score in corner/edges.
When you use Vedaldi's SIFT you can pass to the function the points where you want to calculate descriptors. I pass corners points.

SortedList porting to Silverlight

It looks SortedList is excluded.. What do you think most appropriate out of existing collections? (to keep the same fast access and changes)
Can silverlight Dictionary be permanently sorted?
Best regards
VLK
I ported both the Wintellect Power Collections and the C5 Generic Collections to Silverlight. I made them available here - http://jaykimble.net/powercollections-and-c5-collections-for-silverlight4.aspx.
I did this mostly because this question peaked my interest. Feel free to use them in any type of project you would like to use them with.
To answer your question: No. The dictionary does not guarantee ordered items by key.
However the List<T> supports the BinarySearch method. This can help you acheive similar goals of the SortedList.
The documentation has a nice example of how that is basically acheived. See:-
List<T>.BinarySearch Method (T)
You might take a look at Wintellect's Power Collections. This library is free under the EPL. I think the OrderedMultiDictionary will do the trick for you. You should be able to compile this under Silverlight. I have not used this for a couple of years but did use this library (and Richter's threading library) for a WPF project.
Edit:
After playing around with this it looks like you will need to do a little work to get the power collections to work in Silverlight.
My workaround for not having silverlight was to create a generic list with a KeyValuePair type and then ordering the list.
List<KeyValuePair<int, string>> sampleList = new List<KeyValuePair<int, string>>();
//Assuming you have a set of objects in an array or list
foreach(var item in items)
{
sampleList.Add(new KeyValuePair<int, string>>(item.ID, item.Description))
}
sampleList = sampleList.OrderBy(data => data.Key).ToList();
The effect is the same as using a sorted list.

Resources