Sensing Objects Algorithm

Hi, I am a newbie at LabVIEW and have no idea where to begin but I have a task assigned that I need to finish.
I am asked to develop a part detection algorithm via the setup of different types of sensors. Basically with sensors' output information, the algorithm should be able to detect the presence of parts and of each part, determine the type of material and thickness.
I have no idea where to begin and how to write/develop this algorithm to do the above. All I know is that I should begin by using the DAQ assistant for data acquisition since there's a DAQ card installed into the computer.
Any help would be much appreciated in how I should even start approaching this problem.
Thanks!
Message Edited by ruined on 01-12-2008 04:36 PM

In addition to unclebumps' questions, the algorithm is not part of the data acquisition or the program; it is something which is implemented by the program.
Rather than beginning with the DAQ Assistant, I would begin with a careful description of what the system needs to do. What are the inputs which will be available? (User inputs and measurements.) (Don't forget noise and interference.) What kinds of outputs are required? (Is it a control system or does it display pictures to a user or write a parts inventory to a database?) What kinds of functions relate the outputs to the inputs? (This is the algorithm.) After you have these things specified, then you can begin to design a program to implement the software parts of your system.
Please post back as you have specific questions.
Lynn

Similar Messages

  • Converting objects into Strings

    How would someone convert an object of say (String, int, double, String) into a readable string. I tried the toString() method but all I get is something like this
    Student@1f12c4e

    ..I'm not sure I understand "how" to override. The whole point of this project is to use quicksort on a list of students, unfortunately all I get is the address whenever I use the .toStrings() method.
    Here's what I have, any help would be greatly appreciated-so very close
    import cs1.Keyboard;
    import java.io.*;
    import java.util.*;
    public class StudentTraverse
    public static void main(String[] args)
    String newName;
    int newSocial;
    double newGPAs;
    String newMajors;
    System.out.println("How many Students would you like to add");
    Student newStudent;
    StudentList12 WORK = new StudentList12();
    int total = Keyboard.readInt();
    for(int number = total; number > 0; number--)
    System.out.println("Name?");
    newName = Keyboard.readString();
    System.out.println("Social?");
    newSocial = Keyboard.readInt();
    System.out.println("GPA?");
    newGPAs = Keyboard.readDouble();
    System.out.println("Major?");
    newMajors = Keyboard.readString();
    newStudent = new Student(newName, newSocial, newGPAs, newMajors);
    System.out.println("Inserting: "+newStudent.toString());
    WORK.add(newStudent);
    for(total = 0; total < WORK.size(); total++)
    System.out.println("top" total": "+WORK.top(total).toString());
    try
    BufferedReader in = new BufferedReader(new FileReader("LIST.out"));
    while (in.ready())
    // Print file line to scree
    System.out.println (in.readLine());
    in.close();
    catch (Exception e)
    System.err.println("File input error");
    public class StudentNode
    public Student student;
    public StudentNode next;
    public StudentNode()
    next = null;
    student = null;
    public StudentNode(Student d, StudentNode n)
    student = d;
    next = n;
    public void setNext(StudentNode n)
    next = n;
    public void setData(Student d)
    data = d;
    public StudentNode getNext()
    return next;
    public Student getData()
    return data;
    public String toString()
    return ""+data;
    public StudentNode(Student newStudent)
    METHOD NAME: StudentNode
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Acts as a node for the Student list
    ALGORITHM:Acts as node for the list
    INSTANCE VARIABLES: none
    student = newStudent;
    next = null;
    public class Student
    private String name;
    private int social;
    private double GPA;
    private String Major;
    public Student(String newName, int newSocial, double newGPAs, String newMajors)
    METHOD NAME: Student
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: The actual Student class, determines what is allowed in the array
    ALGORITHM:Declare what variables will be needed for the program
    INSTANCE VARIABLES: String name, int social, double GPA, String Major
    name = newName;
    social = newSocial;
    GPA = newGPAs;
    Major = newMajors;
    import java.io.*;
    import cs1.Keyboard;
    import java.io.BufferedWriter;
    import java.util.*;
    public class StudentList12
    private StudentNode list;
    static int i = 0;
    public StudentList12()
    METHOD NAME: StudentList12
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Declares the Node
    ALGORITHM:Declare the Node
    INSTANCE VARIABLES: none
    list = null;
    public boolean isEmpty()
    return list == null;
    public int size()
    return i;
    public void add(Student newStudent)
    METHOD NAME: add
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Let's users add objects to the array of objects
    ALGORITHM:Traverses the current list and adds object to the end
    INSTANCE VARIABLES: none
    list = new StudentNode(newStudent, list);
    i++;
    current = current.next;
    current.next = node;
    public Student remove()
    if(isEmpty())
    return null;
    StudentNode tmp = list;
    list = tmp.getNext();
    i--;
    return tmp.getData();
    public void insertEnd(Student newStudent)
    if(isEmpty())
    add(newStudent);
    else
    StudentNode t = list;
    while(t.getNext() != null)
    t=t.getNext();
    StudentNode tmp = new StudentNode(newStudent, t.getNext());
    t.setNext(tmp);
    i++;
    public Student removeEnd()
    if(isEmpty())
    return null;
    if(list.getNext() == null)
    return remove();
    StudentNode t = list;
    while(t.getNext().getNext() != null)
    t = t.getNext();
    Student newStudent = t.getNext().getData();
    t.setNext(t.getNext().getNext());
    i--;
    return newStudent;
    public Student top(int n)
    StudentNode t = list;
    for(int i = 0; i <n && t != null; i++)
    t = t.getNext();
    return t.getData();
    public void writeToFile(int n)
    int z = n;
    try
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
    for(int counter = z; counter >= 0; counter--)
    System.out.println(counter);
    out.close();
    catch(Exception e)
    System.err.println("Couldn't Write File");
    try
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
    out.write(list.toString());
    out.close();
    catch(Exception e)
    System.err.println("Couldn't Write File");
    }

  • Raid 0 (Stripe) for OS X boot disk? Best Performance and block size

    Hi,
    so this is a new thread to an older question I had and would like some feedback on;
    I have a new Mac Pro with 4 matched 1TB caviar black drives. I WILL be doing Full Time-Machine Backups, as well as an independant full-system backup regularly.
    That being said, I have 4 drives open and am looking for suggestions. I am leaning toward 2 sets or stripes (one for the OS and one for 'work space', the former with a 32k stripe block size, the latter with 64k (will hold video, audio, scratch, and, yes, Games).
    Does this sound alright? Is there an issue with Striping the boot drive? Is the block size or 32 (or 64) optimal?
    Thanks!
    Dan

    Hi D# Shooter, regarding your question,
    D3 Shooter wrote:
    You brought to mind something I did not take into consideration, Time Machine. I really like the simplicity of TM as it saved me once before. So, could you tell me, for photo files, some video, how much does the striping (% wise) improve the accessing and filing of such files compared to no striping but, using internal drives (7200/WD/1TB/Caviar)? I have not done striping before and want to weigh in because of the back up storage issues now. Thanks.
    J_ust give it a try and see if it is worth it for you_.
    Striping:
    • just enhances (reduces the access/transfer) because in practice the access is distributed in parallel across several DDM's (Old school but it works great!). I think for video and file work the advantage is that you can access the whole object sooner (rather than faster).
    • this distribuition also reduces a load of old style queing on the device ove rthe path. THis was resolved in the late 1980's so no reall rocket science here.
    the issues with striping are few and basically over all the raid implementations (except JBOD which of course is not raid) when compared to a single spindle. The discussions are enormous and plentiful via google and experiences and opinions vary widely.
    Fir the I.T. peole its the advantage they get for access using a smart disk controller that caches goosies like indexes and stuff so that they can sustain a zillion trivial transactions/sec (i.e. banking & internet stuff).. stuff that is of no interest to me
    For the creative people and many applications that are BLOB's (like video, film and remote sensing objects) getting use of the objects sooner (not faster) is of prime importance for workflow efficiencies. If you have this need then striping stiff across disks is for you!
    TIMEMACHINE.app works fine as it seems fairly agnostic to whats implemented under the disk file system. MY issue with time machine is that I don't want it looking after my production stuff, only to keep an eye on my admin I.T. type stuff such as ~/ and data data files.
    As posted on ths thread:
    • availability is the major concern with any file system (cloud or raid or other). RAID with parity schemes and double parity schemes (Raid1,,3,5,6) and implementations such as RAID6+ LSF (log structured file) are all wonderful for this business workflows that need it.
    • timely access in a workflow is another
    • cost benefits are another
    However a *great benefit* for me of *consolidating small storage components under one huge file system is that you dont have to COPY any thing around*. THis is marvelous especially when you think you have to move 2TB's of stuff from one place to anther. THis a takes a lot of time with elcheapo didks that dont have fast interfaces such as SATA/SAS of FC for example.
    As always and has been addressed by others on this thread (Hatter) if you lose a component storage device the whole file system is hosed or severely degraded unless you spend a lot of money on full ranks of DDMs with hot spares and a very good RAID controller card. Again its money.
    YEah sure you can carry some PARITY RAID implementation around across 3 didks but the storage capacity usage is dreadful. THis is why more complex RAID implemntatiosn are in groups of 10+ dDMs.. (yep poepl can argue.. but this is the mainstream).
    My external disk arrays are merely two LUNs (SAS DOMAINSA) that have two file systems implemented using 2 x 4TB 1TBs DDMS - all RAID0 - no parity (no availability) - I just want speed. I look after my own "availability" withm= my archive solution. If the operation dies, I stat again. I'm happy wi that. RAID 5 has write penalty performace hits (well known +update in place+), , RAID 6+ is lousy for huge objects but good for I.T. but ok if you lose two disks in a stripe (RANK).
    They all have their flaws... and mirroring a RAID0 (RAID1/0) seems to be popular with storage vendors because they can see you more disk and thats proper business workflow depends on it.
    However you can achieve this stuff if you change your workflow slightly.
    Other than these the rest is tech specs and stuff under the cover.
    So you what is right for you and your business.
    I dont like spending money on nasty elcheapo FW800 LeCIE disk enclosures with the their junky components and their ilk having been done badly on several corrupted devices and lsing TB;s of content - this is why I invested in a high speed LTO4 ULtrium data tape archive solution.
    sorry for long post..
    w

  • Itunes compilations

    Has anybody else noticed that the ability to set the "Part of Compilation" field is no longer available in iTunes 12.1?

    Mr Tea,
    Thank you for your short explanation. I saw some of the other articles and comments on iTunes 12.1 but none of them said that the "pictures" they were showing required scrolling/resizing/manipulations in order to present fields like "compilation".  The lack of feedback on the "Get Info" screen to indicate that additional user controls are available/needed in order to work with the information provided is a clear FAIL.  I would also say that articles/reviews of iTunes 12.1 that don't clearly illustrate this need to scroll/resize/manipulate screens that have ALWAYS been static panes (as specified by the original and currently in effect Apple Human Interface Guidelines) are misleading the audience.  The key takeaway here is that everything on the screen is not only informational, but also a possible control, a handle to hidden/expanded views, as well as other unexplained and non-indicated forms of activity.
    It used to be that things in Apple software made sense – objects conveyed information as well as conveyed their affordances so that a user without prior knowledge or experience would know what to do.  Now, we have a world where users are REQUIRED to click on everything on the screen in everyday imaginable before they can figure out the basics of how things work, much like the discovery process of a new video game.  The problem is that where video games are entertainment experiences designed to consume time and elicit user interaction, apps like iTunes tend to be more utilitarian and purpose driven. The use of iTunes used to be the playing/purchasing of music/media.  Now the purpose of the app seems to be to ensnare the user into the "experience of media discovery", and as such, useful tools like Get Info will become more and more portals to additional "experiential details" of media.
    I just want to make sure that all tracks on albums from "Artist A" appear under "Artist A", even if a single song has a different/featured artist listed on that track. 
    Thank you to all who have read my rant or helped me figure how to resolve this.

  • Real Paintbrushes on Touch Screen

    I'm considering an optical touch screen monitor for Windows 7 and CS4 (of course).  Has anyone used one yet?
    If you don't know what I'm talking about, check out this video: http://www.youtube.com/watch?v=B90_tqv-5vc
    There are a number of optical multi-touch monitors and PCs out there that sense objects touching the screen using optical sensors and reflectors in the bezel around the edge.  It looks like ArtRage and Painter Essentials (as seen here) are able to sense the shape of a real paint brush touching the screen and create brush strokes accordingly.
    Does anyone know if Photoshop does that as well?

    I have used (and not used) a few different screen protectors on my Eris.  The first one (3-pack) i had was the one sold in the Verizon store when I bought my phone.  It worked pretty good but ended up peeling up in the corner.  I put on a new one from the pack and got all kinds of bubbles from dust and stuff and ruined it trying to fix it, and I don't remember what happened with the third one from the pack.  I next went with Zagg.  This one went on the phone really easy and looked pretty clean, but it was sticky to the touch and I didn't really like it.  It too ended peeling from the corner.  (I work in construction and keep my phone in my pocket so that may be the problem with peeling corners).  I next found a good deal on clarivue screen protectors online and ordered the mirror finish one.  While I loved the effect, it was very hard to see the screen in the sun and got very scratched up.  However the feel of that one was almost like using the phone naked.  I would probably go with a standard protector from that company next, but I have been rocking this bad boy bareback for 3-4 months now and, while there are some small scratches (again, I work in construction), its nothing major and normally I don't notice them.  So, to answer your question, I think any decent screen protector can be scratched with a key and the phone won't get hurt, and I'm sure most brands will have one that fits the Pro.  Check Best Buy or search online to find one that fits your needs.

  • Help BufferWriter

    This is killing me, I can't seem to figure this program out. I'm trying to traverse a list of objects, then write the list to a file. The file is created, but nothing is being written to it. Any suggestions would be greatly appreciated.
    here are the classes
    this is the driver
    import cs1.Keyboard;
    import java.io.*;
    import java.util.*;
    public class StudentTraverse
         public static void main(String[] args)
         String newName;
         int newSocial;
         double newGPAs;
         String newMajors;
         System.out.println("How many Students would you like to add");
              for(int number = Keyboard.readInt(); number > 0; number--)
              System.out.println("Name?");
              newName = Keyboard.readString();
              System.out.println("Social?");
              newSocial = Keyboard.readInt();
              System.out.println("GPA?");
              newGPAs = Keyboard.readDouble();
              System.out.println("Major?");
              newMajors = Keyboard.readString();
              Student newStudent;
              StudentList12 WORK = new StudentList12();
              newStudent = new Student(newName, newSocial, newGPAs, newMajors);
              WORK.add(newStudent);
                   try
                   BufferedReader in = new BufferedReader(new FileReader("LIST.in"));
                        while (in.ready())
                        // Print file line to screen
                        System.out.println (in.readLine());
                        in.close();
                        catch (Exception e)
                        System.err.println("File input error");
    import java.io.*;
    import cs1.Keyboard;
    public class StudentList12
         private StudentNode list;
         public StudentList12()
         METHOD NAME: StudentList12
         AUTHOR: John Tripi
         DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Declares the Node
         ALGORITHM:Declare the Node
         INSTANCE VARIABLES: none
              list = null;
         public void add(Student newStudent)
         METHOD NAME: add
         AUTHOR: John Tripi
         DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Let's users add objects to the array of objects
         ALGORITHM:Traverses the current list and adds object to the end
         INSTANCE VARIABLES: none
              try
              PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
              StudentNode node = new StudentNode(newStudent);
              StudentNode current;
         if(list == null)
              list = node;
         else
              current = list;
              while(current.next != null)
              out.write(current.toString());     
              current = current.next;
              current.next = node;
              out.close();
              catch(Exception e)
              System.err.println("File Not Found");
    public class StudentNode
         public Student student;
         public StudentNode next;
         public StudentNode(Student newStudent)
         METHOD NAME: StudentNode
         AUTHOR: John Tripi
         DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Acts as a node for the Student list
         ALGORITHM:Acts as node for the list
         INSTANCE VARIABLES: none
              student = newStudent;
              next = null;
    public class Student
         private String name;
         private int social;
         private double GPA;
         private String Major;
         public Student(String newName, int newSocial, double newGPAs, String newMajors)
              METHOD NAME: Student
              AUTHOR: John Tripi
              DATE OF CREATION: Nov 20, 2004
              DATE OF UPDATES: Nov 28, 2004
              PURPOSE: The actual Student class, determines what is allowed in the array
              ALGORITHM:Declare what variables will be needed for the program
              INSTANCE VARIABLES: String name, int social, double GPA, String Major
              name = newName;
              social = newSocial;
              GPA = newGPAs;
              Major = newMajors;
    -------------------------------------------

    ok, i've been messing around with the program, and I've gotten it to compile, run, and.....put something in a file. Unfortunately it will only write things like this > StudentNode@1f12c4e
    import cs1.Keyboard;
    import java.io.*;
    import java.util.*;
    public class StudentTraverse
         public static void main(String[] args)
         String newName;
         int newSocial;
         double newGPAs;
         String newMajors;
         System.out.println("How many Students would you like to add");
         Student newStudent;
         StudentList12 WORK = new StudentList12();
              for(int number = Keyboard.readInt(); number > 0; number--)
              System.out.println("Name?");
              newName = Keyboard.readString();
              System.out.println("Social?");
              newSocial = Keyboard.readInt();
              System.out.println("GPA?");
              newGPAs = Keyboard.readDouble();
              System.out.println("Major?");
              newMajors = Keyboard.readString();
                   newStudent = new Student(newName, newSocial, newGPAs, newMajors);
                   WORK.add(newStudent);
                   WORK.writeToFile();
                   try
                   BufferedReader in = new BufferedReader(new FileReader("LIST.out"));
                        while (in.ready())
                        // Print file line to screen
                        System.out.println (in.readLine());
                        in.close();
                        catch (Exception e)
                        System.err.println("File input error");
    public class Student
         private String name;
         private int social;
         private double GPA;
         private String Major;
         public Student(String newName, int newSocial, double newGPAs, String newMajors)
              METHOD NAME: Student
              AUTHOR:
              DATE OF CREATION: Nov 20, 2004
              DATE OF UPDATES: Nov 28, 2004
              PURPOSE: The actual Student class, determines what is allowed in the array
              ALGORITHM:Declare what variables will be needed for the program
              INSTANCE VARIABLES: String name, int social, double GPA, String Major
              name = newName;
              social = newSocial;
              GPA = newGPAs;
              Major = newMajors;
    public class StudentNode
         public Student student;
         public StudentNode next;
         public StudentNode(Student newStudent)
         METHOD NAME: StudentNode
         AUTHOR:
         DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Acts as a node for the Student list
         ALGORITHM:Acts as node for the list
         INSTANCE VARIABLES: none
              student = newStudent;
              next = null;
    import java.io.*;
    import cs1.Keyboard;
    public class StudentList12
         private StudentNode list;
         public StudentList12()
         METHOD NAME: StudentList12
         AUTHOR:
    DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Declares the Node
         ALGORITHM:Declare the Node
         INSTANCE VARIABLES: none
              list = null;
         public void add(Student newStudent)
         METHOD NAME: add
         AUTHOR:
         DATE OF CREATION: Nov 20, 2004
         DATE OF UPDATES: Nov 28, 2004
         PURPOSE: Let's users add objects to the array of objects
         ALGORITHM:Traverses the current list and adds object to the end
         INSTANCE VARIABLES: none
              StudentNode node = new StudentNode(newStudent);
              StudentNode current;
         if(list == null)
              list = node;
         else
              current = list;
              while(current.next != null)
              current = current.next;
              current.next = node;
              System.out.println(current.toString());
    public void writeToFile()
         try
         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
         out.write(list.toString());
         out.close();
              catch(Exception e)
              System.err.println("Couldn't Write File");
    }

  • Applying Leaky bucket algorithm for Distributed Object Computing

    Leaky bucket algorithm is an algorithm which is used in Network Traffic control. Can this be used in optimizing applications which use entity beans?
    This is a very rare scenario where objects are not loaded properly i.e. it is loaded partially. When we try to locate the beans using primary keys we will get Finder Exceptions. This doesn�t happen with all, but only happens with some. In such a scenario we will get exception when we try to locate object.
    For example: A customer at a bank. The operator will be able to do a basic search on customer and pull out the details but operator details cannot be modified because the address bean instance associated with this customer cannot be located. At the same time some customers are fine, because their details can be found. New details can be added.
    What if this is something which should happen with all our applications? We want to create holes in the bucket where the holes can selectively filter out the unnecessary instances and can destroy the instances when the application realizes that there is no use of having this instance anymore.
    This doesn�t make a difference for a small customer base but will certainly make a difference when there are millions of customers and we are looking at optimizing. Yes of course we can archive the data which is no longer required. Archiving is not always the solution when there is a requirement for several million instances this might make a difference and were not ready to be archived when the archiving process ran.
    What will this result in? When a customer is trying to access an account which was not accessed for a year, the customer will get a message, we have your details in our system but you will have to contact the bank to reactivate the account as you have not accessed for a year. Also the old addresses or other details will never be loaded. Loading too much data/information is always bad because we need too much support to carry it and also the other parts of the system starts slowing down.
    In case of container managed persistence, application servers (GlassFish/JBoss/Websphere/Weblogic) probably have other mechanisms to optimize. Of course there is danger of introducing a bug when logics are introduced and should involve extensive testing to verify the efficiency of introduced logic.
    Is this something which is appropriate or am I missing something?

  • Procedural algorithm vs object base algorithm

    i'm a student in a hong kong institution. And i'm using java to write a mutiple player card game as my final year project.
    My supervisor suggest me to think about using a object base or a database to store the game rules: i.e. the algorithm to store the rules.
    However it is really odd to me, becauese when doing some card comparison,let say the player check if his card set is bigger than the other player,i will simply think about a method which receive the other player cardset and do the camparison in the method and then return a true or false value.
    With my supervisor suggestion, now i try to think about storing the comparsion in a database or a object call GameRules which embed the algorithm.
    For the object base approach i have some idea about it advantage e.g. the GameRules object could be implement or extends for other kinds of game.
    But the database approach i really can not imagine.......
    I would like to discuss the topic with you, so that i can learn from you all.

    To put it technically the Game Rules detail game state legality and game state changes as a result of a "move" in the game.
    The Rules are generally detailed individually with references to other Rules.
    It should be possible to abstract out a Rule, a State interface, StateChangeEvent and StateChangeListener interface/abstract classes.
    A game turn consists of an attempt to change the current State of the game. This change can trigger StateChangeEvents, StateChangeListeners can be used to apply appropriate Rules to those changes. A Rule can result in the change being declared illegal, a further change in the game State being made (leading to further events etc) or both.
    A generic way to apply rules is also needed as otherwise (basically which Rules a StateChangeListener should do apply for a given StateChangeEvent. This is more trivial than it sounds fortunately.
    An interesting twist to the use of a Database to store the rules is in how you do it.
    Python (scripting language) can also run in a Java environment as a Jython Script. Now these Jython scripts are simply text, therefore Strings. Now you can store the rules in a database, query for the script you want to run and run the script on the fly. The integration of Java objects into Jython is trivial as well.
    Go look at www.jython.org

  • Please send the algorithm and project code for temperature sensing using daq usbdux fast if possible code also for general text gui icon programming.

    I have a daq card usb dux fast and I'm using linux zenwalk,
    so please if any one has done a program on daq using comedi language or any language or any other related to it.
    please send me the code and algorithm for it.
    if possible a algorithm and code for general gui text icon programming to [email protected]
    thanking you,

    Hi Vinay,
    you know you're posting in a LabVIEW forum?
    When you have questions on Comedi you should post in a Comedi-related forum!
    Or read some papers/manuals like this, easily found by Google...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Algorithm to find the area and color  of the objects in an image

    Hello everyone,
    I have some problems in finding the segmented objects once i find the threshold , i want to find the area of the objects in the image . for example i have some lymphocytes in the image and i need to seperate them from the background by labelling them. can i seperate them by using the colour as well . please give some idea .
    my code till now is:
    int data = -1;
    try {
    System.out.println("Is the input a FloatImage ?");
    m_fi_in = (FloatImage)inputData[0];
    data = 0;
    catch (ClassCastException cce) {
    System.out.println("Not a FloatImage");
    data = -1;
    try {
    System.out.println("Is the input a Volume ?");
    m_vol_in = (Volume)inputData[0];
    data = 1;
    catch (ClassCastException cce2) {
    System.out.println("Not a Volume");
    data = -1;
    System.out.println(data);
    // For the FloatImage
    if (data == 0) {
    // For the Volume
    else if(data == 1) {
    System.out.println("Entering Volume for segmentation....");
    // Get target dimensions
    int depth = m_vol_in.getDepth();
    int height = m_vol_in.getHeight();
    int width = m_vol_in.getWidth();
    int region = 1;
    // Create a label structure
    // Consists of Image and region info
    m_label = new Label(m_vol_in);
    if(m_label == null) {
    System.out.println("Label could not be created");
    return false;
    // apply the threshold set by user
    float threshold = m_threshold.getValue();
    float maxi = m_threshold.getMaximum();
    float mini = m_threshold.getMinimum();
    // label the center of the volume in the region part of label as region 1
    m_label.setRegion(m_start_z.getValue(), m_start_y.getValue(), m_start_x.getValue(), region);
    System.out.println("Set starting voxel ("+m_start_z.getValue()+","+m_start_y.getValue()+","+m_start_x.getValue()+" to "+region);
    // Now process 8 partial volumina starting from a given point in the yz-plane in positive and then negative x directions
    // check the neighbours if they are already segmented and set the region in the target volume accordingly
    // do so for the whole yz-plane
    int x,y,z;
    int dir = 0; // the direction of the search. Only initialised here !
    System.out.println("Processing Volume in z++");
    for (z = m_start_z.getValue(); z < depth-1; z++) {
    for (y = m_start_y.getValue(); y < height-1; y++) {
    dir = 1;
    for (x = m_start_x.getValue(); x < width-1; x++) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    dir = -1;
    for (x = m_start_x.getValue(); x > 0; x--) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    for (y = m_start_y.getValue(); y > 0; y--) {
    dir = 1;
    for (x = m_start_x.getValue(); x < width-1; x++) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    dir = -1;
    for (x = m_start_x.getValue(); x > 0; x--) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    System.out.println("Processing Volume in z--");
    for (z = m_start_z.getValue(); z > 0 ; z--) {
    for (y = m_start_y.getValue(); y < height-1; y++) {
    dir = 1;
    for (x = m_start_x.getValue(); x < width-1; x++) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    dir = -1;
    for (x = m_start_x.getValue(); x > 0; x--) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    for (y = m_start_y.getValue(); y > 0; y--) {
    dir = 1;
    for (x = m_start_x.getValue(); x < width-1; x++) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    dir = -1;
    for (x = m_start_x.getValue(); x > 0; x--) {
    checkRegion(m_label, z, y, x, threshold, region, dir);
    // Apply result to output
    outputData[0] = m_label;
    else {
    return false;
    }

    search for cluster analysis
    spieler

  • Compability problem with Java and Python  RSA algorithm implementation

    I have client server application. Server is writtein in python, client in java. Client receives messages from server encrypted with RSA (http://stuvel.eu/rsa), and I'm unable to decrypt it. It seems that this is RSA algorithm compatibility problem. I'm using algorithm from java.security package, instatinating Cipher object like this: c = Cipher.getInstance("RSA"); . I noticed that this algorithm produces for input blocks of lengtrh <=117 ouput block of length 128. Server I guess uses the most triviall impelentation of RSA ( (1 byte is encrypted to 1 byte) So i want to make my java algorithm compatibile with this one which server uses. How to do that ? Do i have to instatinate Cipher object in different way ? Or use another library ?

    azedor wrote:
    First you said it was no good because it could only handle <= 117 byte inputs, now you say it is no good because it produces a 128-byte output. You're not making sense.First i said that this two RSA implementations are not compatibile, and first reason i noticed firstly is that Python imlementation for input of length N produces cryptogram of the same length. Not true. In general, the RSA encryption of any number of bytes less than the length of the modulus will produce a result of length near that of the modulus. When N is less than the length of the modulus, it is rare that N bytes of cleartext produces N bytes of ciphertext.
    Java implementation for data block of length <=117 produces alwasy 128 bytes of output.Pretty much correct and very much desirable. This is primarily a function of the PKCS1 padding which is used to solve two basic problems. First, as I alluded to in my first response, it is the nature of the algorithm that leading zeros are not preserved and second when the cleartext is very small (a few bytes) the exponentiation does not roll over and it is easy to decrypt the result. Both these problems are addressed by PKCS1 padding.
    >
    >
    After what sabre150 said i think of giving up idea of translating Python code to Java and considering to use another assymetric cryptography algorithms on both sides. Can you recommend me sth what should be compatibile with Python ?This seems to be at odds with your statement in reply #3 "Also have acces only to client code so i have to change sth in java." ! This statement is why I said "I suspect ... you have dug a deep hole".
    In your position I would use the Python bindings for openssl. Once more, Google is your friend.

  • How best to handle hundreds of similar objects?

    Hi. I'm a relative newcomer to Java. I've been working on an application that involves a table of data. Each column in the table represents a different type of data. The data can be numeric, dates, Strings, etc. If I were to create an interface describing the charcteristics that each implementation of a column should have, it would be something like:
    getTitle();
    getDataType();
    getDefinition; //some columns will require explanation (maybe via tooltip or dialog box)
    getValue; //could be simple as pulling a value from a database or could be complicated code
    getDependencies; //identify what other columns may be required to be present in order to calculate getValue();
    getSettingsDialog(); //return JDialog with a custom control panel for the particular column (may include formatting, calculation parameters, etc.)
    etc.
    etc.
    So, the quesiton I'm struggling with is that if in the long run there may be hundreds of unique columns, is it better to create a separate class for each column, or create one class and just parameterize everything. It seemed odd to me to create hundreds of similar classes, so I started out creating one class and creating new instances for each column needed. But, if you do that, how do you store stuff like the code needed for certain methods? For example, the calculations in getValue() could involve lengthy code. Do I just store all of the various getValue() code in one big static class that the column instance would look up or call? Or should I just switch to creating a new class for each column I need (all obviously deriving from the same abstract class/interface)?
    Sorry if this isn't clear. I have been reading through various OOPS and design pattern books, but haven't found anything that clears this up definitively. Thanks.

    Bob.B wrote:
    Some of the data comes from a database, but a lot of it is then derived from that data. There really can be hundreds of columns. The data I'm dealing with is kind of esoteric, so I'll try to describe the situation with a more common set of data. Imagine you were lucky enough to own McDonalds (the whole company) and you wanted a view of how all of the franchises were doing (the franchises would be the rows in the table). Each franchise will have hundreds of characteristics about it stored in some database (e.g. owner, address, city, state, date opened, total hamburger sales each day, total milkshake sales each day, etc. etc.). The application is essentially a treetable that allows the user to 1) pull whatever franchises he wants based on user criteria, 2) group and subtotal the franchise data on any available field (e.g. group and subtotal franchise data by city), and 3) choose what data (i.e. columns) is displayed.
    "Treetable" is a GUI item. You probably shouldn't be pulling the entire dataset, but rather pulling it at once.
    The data structure can drive the GUI but it probably shouldn't be the sole driving factor. Unless the only goal is to drive a reporting engine. See below.
    If the columns merely pulled the data as is from the database, it would be pretty straightforward to just have one column class that knows which db field to pull and then display. But, imagine that there are many more potential columns that get a little bit more complicated. For example, there may be standard metrics that are not directly stored in the database because they can be derived. For example, hamburger sales per store, hamburger sales per day for each day of the week, the ratio of hamburger sales to milkshake sales, etc. Anyway, with the data I'm dealing with, these calculations can get quite complex and there are actually many, many standard metrics that the user would want to see. There are also aspects of the data that the user would want to control on the fly (i.e. have access to column by column settings).
    Presumably you are carefully controlling the data calculation. If it pulls a number today for last weeks data it must be able to pull that same number next year even if how the result is calculated changes later this year.
    So, I think it makes sense for the columns to each be separate objects. I started by having one column class, and when I needed a complicated getValue() function in it, I just stored the calculations in one giant static class that has all the various calculations, and I access the appropriate calculation in that class with a switch statement. I just wasn't sure if this was the most efficient way to do it. It would be easier for me to just have a separate class for each column (all with the same interface), but I didn't know what the overhead in Java was to have hundreds of distinct classes.
    Sounds like a report to me. One layer encapsulates real data. Another layer encapsulates reporting. Values that appear on reports are either data or they are calculated from the data. Notice the the report layer, not the data layer, does the calculation.
    Keep in mind that the calculations themselves might be data driven but by their own data layer. This can include parameters of the calculation, like sales tax for the given period, or the calculation itself (for instance by keeping the algorithm as a java class in the database.)
    Also note that reporting (which includes more that printed reports) is not new and there are commercial and freeware frameworks for it.

  • Explicitly tagging an object as unused

    Just read an article on gc tuning (http://www-106.ibm.com/developerworks/java/library/j-perf06304/?ca=dgr-lnxw07BlogFix)
    where memory leaks are caused by the so called "unintentionally retained objects".
    Currently, detecting memory leak in Java is done using memory profiler to monitor
    memory usage and select which objects are suspected to cause of memory leaks.
    Then, the programmer must decide/guess which of the suspected objects really cause
    memory leaks.
    Is it worthed to provide an API that explicitly tags an object as unused, so that memory
    profilers can find which objects are 100% the cause of memory leak? The notion of this
    API is similar to free in C, however, this API does not affect the decision made by gc
    regarding the reclaimability of an object, nor does it force gc to reclaimed the object.
    Object marked by this API means "I'm no longer needed by the user/program/algorithm.
    Hence, I should be able to be reclaimed by gc. If gc deemed I'm still referenced, this
    means the programmers make mistakes, and thus, they must fix the program".

    Just read an article on gc tuning where memory leaks are caused by the so called "unintentionally retained objects".Quote: From the final memory profile (Figure 3), with the major memory leak eliminated, we can see that there still is another "low grade" leak, but this leak is small enough that it can be ignored until the next release.
    If you are getting memory management advice from articles by people who are happy to release software that they know is leaky, then you're in trouble. (OK, so my background is flight control software where leaks would be a matter of life and death, but these people seem to have no sense of personal honour.)
    Currently, detecting memory leak in Java is done using memory profiler to monitor memory usage and select which objects are suspected to cause of memory leaks.Only do what is necessary to perform the required functionality. If having a reference to an object is functionally necessary, then that reference is required and will not be a leak. If you have a reference that is not required for the functionality, then you shouldn't have that reference any more. Cases where performance requires that a value be cached in case it is may be needed are already catered for with the WeakReference and SoftReference APIs.
    Is it worthed to provide an API that explicitly tags an object as unused, so that memory profilers can find which objects are 100% the cause of memory leak? No, for the same reason that there is no goto in Java. If you are writing software that is so convoluted you don't know what objects are referencing each other, adding an API that encourages you do that more will not help you.
    If gc deemed I'm still referenced, this means the programmers make mistakes, and thus, they must fix the program".If you are debugging badly written code, and do not have access to a static analysis tool which will tell you where your objects are being referenced, then you have the option of creating a reference queue and a phantom reference to your suposedly unreferenced object, clearing all references in your algorithm, forcing gc, and then asserting that the phantom reference was cleared.
    Pete

  • Rotating object sampling quality issues

    A student of mine asked this question today. Rotating sharp-edged artwork seems to be problematic in Photoshop.
    Take this grid:
    Original file (6 colours):
    www.estructor.biz/testje/grid2.png
    Now rotate by 45 degrees.
    These are the results in Photoshop CS6 labeled by sampling method:
    www.estructor.biz/testje/ps_grid.png
    And these are the results in Photoline (latest beta introduced improved two new sampling algorithms):
    www.estructor.biz/testje/pl_grid.png
    I uploaded the raw png files to my own server, otherwise the quality may be affected by the upload function here.
    To compare both, open them in Photoshop and zoom to 200% or 400%, and notice how Photoshop's versions do not compare favourably: some sort of unsharp mask sharpening effect was introduced, resulting in halos.
    The CatmullRom version generated in Photoline seems to be the best one, though the ones with MitchellNetravali, Lanczos3 and even bicubic all arguably produced better anti-aliased versions than the ones in Photoshop. In Photoshop only Bicubic Smooth is acceptable (in my opinion), though the anti-aliasing is too smooth looking.
    I am aware the effects can be subtle - though they are quite noticeable. I mean, why does Photoshop's bicubic sampling prodube such an inferior version compared to Photoline? It makes no sense.
    A secondary observation I made is that Photoshop's version introduced 2271 colours into the rotated version, while Photoline only used 231 unique colours after transformation. Which, with Photoline's version being the superior one, exacerbates the problem in my view, because it will add to the final artwork's file size (may be very important for both web graphics and 2d game graphics).
    From a user experience view point, another issue is that Photoshop CS6 will not render the final result as a preview before the actual transformation is applied - meaning the user is left to first apply the transformation, and then she/he is forced to undo, and redo until satisfied. In Photoline, for example, the transformation's sampling method can be changed and the actual result is shown before committing to a sampling method.
    All this is not that important to me for my own personal work, because I switched to Photoline and other software more than a year ago. However, I do still want to be able to answer questions from students in regards to Photoshop, so I feel it is an important aspect.
    So, my (and my students') questions are:
    - is it possible to turn off that unsharp mask-like effect when rotating?
    - are there ways to improve the sampling somehow?
    - down-sampling sharp artwork also introduces similar problems. Any way to circumvent them?
    - placing the grid/dragging the grid file into a photoshop file produces a terrible result. Only by opening the grid file first, and copying and pasting is the original artwork preserved. Drag and drop does not function properly (and refuses to place at 100% automatically). Any solutions to change the drag and drop behaviour to automatically resample?
    (btw, this does not happen in Photoline either - drag and drop does not (and should not!) resample in this case!)
    - have these issues been resolved in Photoshop CC latest version?
    - if the current versions of CS6 or CC do not offer solutions for this type of work, is this something that will be fixed in an upcoming release? Or is it not at all on the radar?
    Thanks.
    ps As mentioned before in the Illustrator forum, exporting sharp artwork from Illustrator at low screen resolutions is by far the lesser of a viable option - the anti-aliasing is absolutely horrid, unless the artwork is directly imported into Photoshop and severely blown up, and then scaled down. And even then the results are not on par with Mitchel-Netravali and Catmul Rom.

    @Steve: thanks, but I am quite experienced, and I did not import the vector itself, but a straightforward bitmap grid to avoid any interpolation while importing and converting the vector graphic itself. Also see the first paragraph in my response to Mike below .
    @Mike: importing the grid as a smart illustrator object does indeed help - but the lines are too thick and dark looking compared to Mitchell-Netravali and Catmull-Rom.
    Exporting your screen sized artwork from Illustrator using the save for web option is positively the worst option: the quality is unacceptable in most cases. I've done a small write up concerning the bad anti-aliasing as a result of Illustrator's web export here:
    http://forums.adobe.com/message/6002543#6002543
    The only workable solution to get the best anti-aliased down-scaled artwork from Illustrator is to blow up the artwork to a large size, then rasterize, and scale down again. Even then the final quality as a result of the built-in sampling algorithms of Photoshop will not be on par with Photoline or ImageMagick.
    And, of course, not always is a vector version available. The screen artwork I receive is often bitmap based, which proves to be problematic for transformation jobs in Photoshop.
    Gif is merely 8bit indexed, and would not solve the issue - reducing the number of colours is no solution for poor anti-aliasing along edges.
    @Chris: I am unsure how you can say that - yes, Catmull-Rom is known to be a less than ideal re-sampling method for up-scaling images. That said, it works wonderfully well for down-sampling images or as a sampling method to transform lower resolution bitmap based artwork - essential for screen based work and web jobs.
    Lanczos does a meagre job for down-sampling (with Lanczos8 especially bad in terms of artifacts), but a very good job for up-sampling images. We have to know the goal to identify the best method/approach/solution.
    Although I am certain you are familiar with the math, the example shown on this page demonstrates that Catmull-Rom and Mitchell-Netravali do in fact work best for down-sampling images: http://pixinsight.com/doc/docs/InterpolationAlgorithms/InterpolationAlgorithms.html
    And I am not inventing all this - for lower resolution sharp edged illustrative artwork Photoshop has always been rather awkward. The sampling methods currently implemented in Photoshop deal very well with high resolution artwork and photographic media, but fare poorly with lower resolution graphics.
    The demonstration files I prepared earlier and linked in my original question show unequivocally that Photoshop's current sampling algorithms deal poorly in this regard! I did not even bother to include Bicubic Automatic, because that looked positively awful.
    I do understand why that is - traditionally it has never been Photoshop's focus I think. Looking at the bare-bones results, though, I am inclined to conclude that both Mitchell-Netravali and Catmull-Rom do indeed produce superior results for down-sampling and re-sampling during transformations of lower resolution images - both sharp-edged artwork, as well as photos.
    This has been my experience for years now dealing with 2d game graphics, web work, and general screen graphics work. It is one of the reasons why I left Photoshop and Illustrator early on for this type of work.
    So it eludes me why these are not available in Photoshop. Because as far as the results are concerned, they seem to be quite good enough to ship.

  • Java Algorithm problems?

    Im writing a simple calculator program and somehow the algorithm gets stuck on my nerve as i've been around the problem for so long.
    The problem is that i dont know how to implement an algorithm for the dot(.) operator. How do i write it so that when we press numbers and then press the dot operator and finally press another number button the value should be number.number. This value is then used in arithmetic calculations.
    e.g.
    press 56, press "." operator, press 2 should make the value: 56.2
    Problem is how do i implement the algorithm to do that? Help!
    Any help would be greatful
    many thanks in advance...

    You don't give us much to go on, for instance how are implementing your calculator to begin with, what you mean by a press (as in a JButton? or as in the keyboard?)
    Actually, it probably doesn't matter if it's a Jbutton or key pres since you can use the same Action for both, one attached to the button via it's setAction method and attached to the keystroke via key bindings. So you could have the actionPerformed method inside the Action object place a "." string in your calculator's JTextField. If this doesn't make sense, then post an SSCCE .
    BTW, I'm guessing that this is a Swing app, but given what you've told us, I don't really know.
    Edited by: Encephalopathic on Jun 28, 2008 1:54 PM

Maybe you are looking for

  • Change color of vector shape in library with AS?

    Hello, I am working on a project that some one else created. There were very orgainized, but my question is this: There is a starburst shape, and in the property inspector it is labeling as yellow burst, and that's how it shows in the library. But on

  • Problem with putting applications onto ipodtouch

    my ipodtouch is synced with my dad's computer and so i cant put applications from my computer onto it. i am not allowed to delete the applications that he has already put on the ipod so i cant just sync it to my computer.

  • Application Group URL generation - config steps required

    Hi We have ECC6 and using Erecruitment release 603. I am seeking guidance on how to generate application group URLs ie the configurations steps required in order for the URL to be generated. many thanks Julie

  • Mac laptop and Tuneupmymac

    is Tuneupmymac a product that I should NOT have? I have found strange things happening after it started popping up scanning and attempting it to clean my mac. I have diasllowed it each time and quit the program. Should I try to somehow uninstall what

  • MacBook Pro settings to hear XM Satellite Radio

    XM Radio came in loud and clear when I first received my MacBook Pro using wireless. Now I open XM but no sound. I get sound on other sites. Any specific settings required? XM tech support suggests opening ports 80 (HTTP) or 1755 (UDP, TCP). Does Mac