Bmp to 2D Array

Hello
I'm trying to convert an bmp-File into a 2-d array which should conatin the values of each pixel. I created this VI but it doesn't work. Could somebody tell me why not?
Thanks
Simon
PS: I succesfull created the opposite. A VI which creates a bmp out of a 2d array. Now I failed to do it vice versa :-(
Using Labview 7.1
Attachments:
2d Array ausBitmap.vi ‏20 KB
Bitmap aus 2d Array.vi ‏317 KB

You are writing a 24 bit pixmap, but then try to read a 8 bit pixmap. The two must match.
(You should also try to use the correct datatypes)
Message Edited by altenbach on 07-26-2006 10:05 AM
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Loading file of BMPs into one array

    Hi, 
    For some reason I am having trouble loading a batch of BMP files into one 2D array.  I have attached the VI I have been messing with for some time now... (as well as a couple sample BMPs if someone wants them)
    I want to take each BMP in a folder, extract the 2D array and put it into one array.  Each new image's 2D array goes on the row after the previous image.
    Any help for this seemingly simple problem?
    Solved!
    Go to Solution.
    Attachments:
    loadBMPs.vi ‏13 KB
    DataBMP.zip ‏3 KB

    1) You are correctly finding the filenames... but what are you doing with the single path? That's only going to store the last one in the loop... and you don't connect it to the BMP vi. 
    2) You should just do everything in the for loop. 

  • Help on converting bmp to 8bit grayscale arrays

    I am using Labview 6, and need to read a bmp file and obtain the grayscale values in an array to analyse the data. What is the best way of doing this.

    Hi mepgkas;
    I do not have a clear idea of what you want to accomplish. I tried to go through your vi, but it is not clear to me how it is suppose to work with the images.
    In the attachment you will find three VIs. The first (formula_final_2.vi) do the same as your first VI. I just modified it a little to try to understand its operation. I hope you find the modifications helpful.
    The second file (formula_final_test.vi) is also your original VI. I modified it to work as a subVI. The third VI (example w gray.vi) uses the second VI as a subVI and input the two images. I assumed that picture 1 should go in ta1, picture 2 should go in ta2 and the resulting array is formed using t2 as it elements. Chances are I am wrong, however, it shoul
    d give you a good starting point.
    Best regards;
    Enrique
    www.vartortech.com
    Attachments:
    example_2.zip ‏43 KB

  • Bmp image array, how to draw it on page

    I do not mess arround with Flex all to much so forgive the poor question title.
    I do not use Flex to open a socket connetion to an embedded device. From there i send and get information.
    I need to display a 320x240 image. I cannot use the typical way for getting an image like i have see you guys use for nabing it from a server. I have to send the data up through this socket connection. I can handle all that. So to make things simple lets say i have created an array of the image data in RGB or BGR format.   How can i draw out this data.

    When you do any displayable graphic manipulation in Java it's usually going to be through an override in your paint/paintComponent (awt/swing). You need to read the Java tutorial on how to do graphics--here is a rough on how:
    I'll assume you want to have a graphic object to save when you are done--
    get the graphic context of your image (look in the API under BufferedImage--I suggest using BufferedImages)
    make a change to the graphic context of the image
    call repaint()
    Graphics2D biGraphics = bi.createGraphics();
    //your code here to make changes to the image
    //by manipulating the Graphics context biGraphics
    repaint();Now your override for paintComponent (I'll assume you are using SWING for this and your image name is bi).
    public void paintComponent(Graphics g){
      super.paintComponent(g);
      g.drawImage(bi, 0, 0, this);
    }

  • Save an 16 bits grayscale image in a bmp file

    Hello,
    I need to save a bmp file using an I16 grayscale picture.
    I already did the following VI that saves the picture in bmp but the colors are not good : there is only blue levels.
    I think there is a problem with the type of data that feed "array to color image" or with the colorscale but i don't manage to find where.
    Hope you can help me.
    Tank you.
    Ben 

    Hi
    The arraytocolorimage expects U32 because expects a RGB color, try this instead of the "toU32"
    Rodrigo Cuenca
    www.cidesi.com

  • How can I convert a bitmap image into an array in LabVIEW 6.0.2, then to a spreadsheet for further analysis without NI-IMAQ or Vision?

    I do not have NI-IMAQ or NI Vision.
    I acquired the image using a picolo board then just saved it as a bitmap file.

    You want to convert it to an array of what? Of numbers? Of LabVIEW colors?
    The "Read BMP File.vi" VI outputs a 1-D array of the pixels, but I suspect it is not exactly in the format that you need. I am NOT sure, but I think that each group of 3 elements of that 1-D array (which is inside the cluster "image data" that the VI outputs) represents the red, green and blue levels of a single pixel (but it may be hue, saturation and lum.). Also, since it is a 1-D array, you would have to divide it by the width (which is also included in the "image data" cluster) to get some sort of 2-D array of data.
    You can find the "Read BMP File.vi" VI in the functions palete> "Graphics & sound">"Graphics Formats".

  • How can i convert a hexidecimal image file to a bmp file

    i have an array of hex data, each of the 7707 rows has 80 characters, i want to convert this to a standard windows bmp or jpeg file, any ideas how to do it?

    stewbert;
    Is that only one image or there are several images in that array? If the array is the image, and columns (number of characters) and rows correspond to what you are saying your array contains, it is a big image!
    There are other questions that needs to be answered, like, each character, how many numbers contains (looks like "EF" or like "EF3B5A".) Such sizes give ideas of the format and to where is the color table.
    You can play with the "Draw XXX Pixmap" VIs located in Function palette -> Graphics & Sounds -> Picture Functions and see if one of them renders an image.
    I think the best would be if you can post a sample of your array so somebody here can look at it and try to "decode" it.
    Regards;
    Enrique
    www.visecurity.com
    www.vartortech.com

  • Using the value "Image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of preconfigured file types (.jpe, .jpg, .jpeg, .?

    On a form, using the value "image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of pre-configured file types (.jpe, .jpg, .jpeg, .gif, .png, .bmp, .ico, .svg, .svgz, .tif, .tiff, .ai, .drw, .pct, .psp, .xcf, .psd, .raw)?
    Say I wanted to add .gif, .jfif or .ico. I find this array limited, how can I add types to image?
    <input type="file" name="file" accept="image/*" id="file" />
    mimeTypes.rdf does not seem to allow this.

    ''mimeTypes.rdf'' has nothing to do with web development. It's a file that stores your file handling preferences (e.g. if you want ZIP files automatically saved or opened).
    You can't change the file types of the pre-defined content specifiers (audio/*, video/*, image/*), but you can specify additional MIME types. To add PDF to your above example,
    <pre><nowiki><input type="file" name="file" accept="image/*,application/pdf" id="file" /></nowiki></pre>
    For details, see
    * [https://developer.mozilla.org/En/HTML/Element/Input developer.mozilla.org/En/HTML/Element/Input]

  • Deploying BMP Entity Bean with primary key calss

    Hi,
    I am using EJB 2.0 with and websphere studio 5.0 and database is sql server 2000.
    My BMP Entity bean has a primary key class.From my client I am invoking the Entity Bean by calling it's findbyprimarykey method.
    The home interface of my findbyprimarykey method returns a class of type Remote.But in the Entity Bean class,the return type is the primarykey class type.
    My problem is invoking this findbyprimarykey from the client to get the remote interface so that the other business methods of the entity bean can be called.
    The control goes into the ejbFindbyPrimaryKey but when it is returing from the Entity Bean class,it gives a remote exception (as the return type in Entity Bean class and Home interface are different for the findbyprimarykey method).
    I think that somewhere in the deployment decriptor in my websphere,i have to specify the primarykey class type,which i am missing out and hence getting the error.
    Please help me out with your advice and solution.
    Thanks
    Rahul Priyadarshi

    Hi,
    Sorry to disturb you again.
    Even my code is also almost the same....i am pasting the code below...Please go through it and let me know if I have made any mistake..
    EditVendorEntityBean.....(Bean Class)
    package code.beans.EditVendor;
    import code.beans.dataAccess.*;
    import javax.ejb.CreateException;
    import javax.ejb.RemoveException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.EJBException;
    import javax.ejb.FinderException;
    import javax.ejb.ObjectNotFoundException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    * Bean implementation class for Enterprise Bean: EditVendorEntity
    public class EditVendorEntityBean implements javax.ejb.EntityBean {
         private static Hashtable dataSources = new Hashtable();
         private String username;
    private int Vendor_ID;
    private int Category_Id;
    private String Category_Name;
    private String Vendor_Name;
    private String Vendor_Address1;
    private String Vendor_Address2;
    private String Contact_Name;
    private String Home_Phone;
    private String Work_Phone;
    private String email;
    private String faxno;
    private String userloginname;
    private boolean dirtyFlag = false;
    private EntityContext context;
    private static final String DS_NAME = "jdbc/spiPOPS";
    Connection con = null;
    Statement stmt = null;
    PreparedStatement st = null;
    ResultSet res = null;
         //***********************Business Methods*********************
    // Begin of Busines Methods
    public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax) {
              System.out.println("in setData where Vendor Id= "+ Vendor_ID);
                   boolean status=false;
                   boolean existing=false;
                   ArrayList cat=new ArrayList();
                   try
                        cat=getcategorylist(this.Vendor_ID);
                   catch(SQLException e)
                        System.out.println("Could not get category list");
                   System.out.println("Size of cat array -->" + cat.size() + " and string array size -->" + catname.length);
                   if(catname.length>0)
                        //Removing unwanted vendor categories for a particular vendor id
                        for(int i=0;i<cat.size();i++)
                                  existing=false;
                                  String tempdata=(String)cat.get(i);
                                  for(int j=0;j<catname.length;j++)
                                       if(tempdata.equals(catname[j]))
                                            existing=true;
                                  if(!existing)
                                       try
                                            delvencat(this.Vendor_ID,tempdata.trim());
                                       catch(SQLException e)
                                            System.out.println("Could not delete record in POPS_VENDOR_CATEGORY for -->" + tempdata);
                   //Adding new vendor categories for a particular vendor
                        try
                                  for(int i=0;i<catname.length;i++)
                                       status=false;
                                       String strcat=catname;
                                       status=checkcat(this.Vendor_ID,strcat.trim());
                                       if(!status)
                                            insertvencat(this.Vendor_ID,strcat.trim());
                        catch(SQLException e)
                                  System.out.println("Could not insert or select from POPS_VENDOR_CATEGORY table");
                   this.Vendor_Name          =vendorname;
              this.Vendor_Address1     =vendadd1;
              this.Vendor_Address2     =vendadd2;
              this.Contact_Name          =vendcontact;
              this.Work_Phone               =venoff;
              this.Home_Phone               =venres;
              this.email                    =mailid;
              this.faxno                    =venfax;
                   dirtyFlag = true;
                   System.out.println("Leaving set data method");
    public Vector getData() {
         Vector vctRec=new Vector();
         ArrayList arrdatas = new ArrayList();
         arrdatas.add(""+this.Vendor_ID);
         arrdatas.add(this.Vendor_Name);
         arrdatas.add(this.Vendor_Address1);
         arrdatas.add(this.Vendor_Address2);
         arrdatas.add(this.Contact_Name);
         arrdatas.add(this.Work_Phone);
         arrdatas.add(this.Home_Phone);
         arrdatas.add(this.email);
         arrdatas.add(this.faxno);
         vctRec.addElement(arrdatas);
         ArrayList cat=new ArrayList();
              try
              System.out.println("Calling getcategorylist from getdata with vendorid-->" + this.Vendor_ID);
              cat          = getcategorylist(this.Vendor_ID);
         catch(SQLException e)
                   System.out.println("Could not get datas for category list");
         vctRec.addElement(cat);
         ArrayList allcats=new ArrayList();
         try
                        allcats          = getallcategorylist();
              catch(SQLException e)
                        System.out.println("Could not get datas for category list");
         vctRec.addElement(allcats);
              dirtyFlag = false;
         System.out.println("Before return statement in getdata with vector size -->" + vctRec.size());
              return vctRec;
    // End of Business Methods
    //**************************Entity Bean Methods*******************************
         * ejbActivate
         public void ejbActivate() {
              Vendor_ID = Integer.parseInt((String)context.getPrimaryKey());
         System.out.println("Inside ejbActivate Vendor_ID-->"+ Vendor_ID);
         * ejbLoad
         public void ejbLoad() {
              System.out.println("Inside ejbLoad ********" );
    try {
    loadRow();
    }catch (Exception ex) {
              System.out.println("Failed in loadRow()");
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * ejbPassivate
         public void ejbPassivate() {
         System.out.println("Inside ejbPassivate " );
    Vendor_ID = 0;
         * ejbRemove
         public void ejbRemove() throws javax.ejb.RemoveException {
              //Empty Method
         * ejbStore
         public void ejbStore() {
    System.out.println("Inside ejbStore " );
    try {
    storeRow();
    }catch (Exception ex) {
              System.out.println("Exception thrown in storeRow" + ex.getMessage());
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * getEntityContext
         public javax.ejb.EntityContext getEntityContext() {
              return context;
         * setEntityContext
         public void setEntityContext(javax.ejb.EntityContext ctx) {
              System.out.println("Inside setEntityContext " );
    try{
         con = getConnection(DS_NAME);
         System.out.println("DB Connection Created!!");
    catch(Exception e){
    this.context = ctx;
         * unsetEntityContext
         public void unsetEntityContext() {
    System.out.println("Inside unsetEntityContext " );
    closeDbConnection(con, res, st);
    this.context = null;
         * ejbCreate
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbCreate(String vendorid)
              throws javax.ejb.CreateException {          
              return new EditVendorEntityKey(vendorid);
              //return null;
         * ejbPostCreate
         public void ejbPostCreate(String vendorid) throws javax.ejb.CreateException {
              //Empty
         * ejbFindByPrimaryKey
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbFindByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey primaryKey)
              throws javax.ejb.FinderException {
    try {
    if(selectByPrimaryKey(Integer.parseInt(primaryKey.getVendorId()))) {
              System.out.println("Leaving the findbyprimarykey method from the entity bean");
         return primaryKey;
         //return null;
    }else {
         throw new ObjectNotFoundException
         ("Row for id " + primaryKey + " not found.");
    }catch (Exception ex) {
    throw new EJBException("EXCEPTION IN ejbFindByPrimaryKey :- " + ex.getMessage());
         /*********************** Database Utility Routines *************************/
    private boolean selectByPrimaryKey(int priKey)
    throws SQLException {
         System.out.println("inside selectByPrimaryKey for primary key " + priKey);
    String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR WHERE VENDOR_ID = " + priKey;
    System.out.println("in selectByPrimaryKey where queryString is: "+ queryStr);
              stmt = con.createStatement();
    ResultSet result = stmt.executeQuery(queryStr);
    if(!result.next()) {
    stmt.close();
         System.out.println("Did not find "+priKey);
    return false;
    else { //Found the primaryKey
    Vendor_ID = result.getInt("VENDOR_ID");
    stmt.close();
    return true;
    private void loadRow() throws SQLException {
              System.out.println("inside loadRow ...");
              stmt = con.createStatement();
              String queryStr = "SELECT VENDOR_NAME,VENDOR_ADDRESS1,VENDOR_ADDRESS2,CONTACT_NAME,HOME_PHONE,WORK_PHONE,EMAIL_ID,FAX_NO " +
                                  "FROM POPS_VENDOR WHERE VENDOR_ID=" + Vendor_ID;
              System.out.println("Inside loadRow()***********"+queryStr);
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catadatas=new ArrayList();
         if(!result.next())
         throw new SQLException("No record for primary key" + Vendor_ID);
              this.Vendor_ID               =Vendor_ID;
                        this.Vendor_Name          =result.getString("VENDOR_NAME");
                        this.Vendor_Address1     =result.getString("VENDOR_ADDRESS1");
                        this.Vendor_Address2     =result.getString("VENDOR_ADDRESS2");
                        this.Contact_Name          =result.getString("CONTACT_NAME");
                        this.Home_Phone               =result.getString("HOME_PHONE");
                        this.Work_Phone               =result.getString("WORK_PHONE");
                        this.email                    =result.getString("EMAIL_ID");
                        this.faxno                    =result.getString("FAX_NO");
                             System.out.println("Leaving loadrow method with loaded datas for vendor -->" + Vendor_ID);
                             stmt.close();
    private ArrayList getcategorylist(int vendor) throws SQLException{
              String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID=" + vendor;
              System.out.println("Query for the cat list --> " + queryStr);
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catdatas=new ArrayList();
    try{
                   while(result.next())
                        catdatas.add(result.getString("VENDOR_CAT"));
              catch (SQLException e){
                   stmt.close();
                   System.out.println("Could not retrieve datas for Category list");
              stmt.close();
              System.out.println("size off array for cat -->" + catdatas.size() + " and datas ->" + catdatas);
              return catdatas;
         private ArrayList getallcategorylist() throws SQLException{
                   //String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY";
                   StringBuffer strquery=new StringBuffer(20);
                   strquery.append("SELECT DISTINCT(CATEGORY_NAME) FROM POPS_CATEGORY");
                   stmt = con.createStatement();
                   //ResultSet result = stmt.executeQuery(queryStr);
                   ResultSet result = stmt.executeQuery(strquery.toString());
                   ArrayList catdatas=new ArrayList();
                   try{
                        while(result.next())
                                  //catdatas.add(result.getString("VENDOR_CAT"));
                                  catdatas.add(result.getString("CATEGORY_NAME"));
                   catch (SQLException e){
                             stmt.close();
                             System.out.println("Could not retrieve datas for All Category list");
                   stmt.close();
                   return catdatas;
         private void delvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              stmt = con.createStatement();
              String queryStr ="DELETE FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + vencat.toUpperCase() + "'";
              System.out.println("Delete query --> " + queryStr);
              update= stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Did not find data to delete");
              stmt.close();
         private void insertvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              String queryStr ="INSERT INTO POPS_VENDOR_CATEGORY(VENDOR_ID,VENDOR_CAT)" +
                                  " VALUES(" + vendor +",'" + vencat + "')";
              System.out.println("Insert query --> " + queryStr);
              stmt = con.createStatement();
              update=stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Could not insert records in the database");
              stmt.close();
         private boolean checkcat(int vendor,String catven) throws SQLException {
              boolean datastatus=false;
              String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + catven.toUpperCase() + "'";
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              datastatus=result.next();
              stmt.close();
              return datastatus;
    private void storeRow() throws SQLException {
                   System.out.println("Inside ejb store");
         if (!dirtyFlag) {
         System.out.println("Skipping the UPDATE because object is not dirty");
         return;
         CallableStatement cs=null;
    try{
                        cs = con.prepareCall("EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        System.out.println("\n\n SQL Statement : \n " + "EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        cs.executeUpdate();
              catch (SQLException e){
                        cs.close();
                        System.out.     println("\n\n Error in calling stored procedure POPS_INSERT_NEW_REQUEST \n\n"+ e.getMessage() + "\n\n");
              cs.close();
              dirtyFlag = false;
         private Connection getConnection(String dbName) throws SQLException
              String configuredDataSourceName = null;
              if (dbName == null) {
                   System.out.println("Attemp to get connection failed. The requested database name is null");
              DataSource dbSource = getDataSource(dbName);
              return dbSource.getConnection();
         private DataSource getDataSource(String dbName)
              // looking from cache;
              DataSource dbSource = (DataSource) dataSources.get(dbName);
              if (dbSource == null) { //we need to find it from JNDI
                   try {
                        Context ic = new InitialContext();
                        dbSource = (DataSource) ic.lookup(dbName);
                        dataSources.put(dbName, dbSource);
                   }catch (NamingException e){
              return dbSource;
         * User calls this function to safely close an connection
         * @param connt The connection a datasource
         * @param rs The resulSet inside this connection
         * @param statement The statement associate with this connection
         private void closeDbConnection(Connection cont,ResultSet rs,Statement statement)
              if (rs != null)
              try {
                        rs.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (statement != null)
                   try {
                        statement.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (cont != null)
                   try {
                        cont.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
         } //closeDbConnection
    EditVendorEntity (Remote Interface)
    package code.beans.EditVendor;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    import java.util.*;
    * Remote interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntity extends javax.ejb.EJBObject {
         public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax)
                   throws RemoteException;
    public Vector getData() throws RemoteException;
    EditVendorEntityHome (Home Interface)
    package code.beans.EditVendor;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import javax.ejb.DuplicateKeyException;
    import javax.ejb.EJBHome;
    import java.util.*;
    * Home interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntityHome extends javax.ejb.EJBHome {
         * Creates an instance from a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity create(String vendorid)
              throws javax.ejb.CreateException, java.rmi.RemoteException;
         * Finds an instance using a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity findByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey Vendor_ID)
              throws javax.ejb.FinderException, java.rmi.RemoteException;
    EditVendorEntityKey (Primary Key Class)
    package code.beans.EditVendor;
    * Key class for Entity Bean: EditVendorEntity
    public class EditVendorEntityKey implements java.io.Serializable {
         static final long serialVersionUID = 3206093459760846163L;
         public String primkey;
         * Creates an empty key for Entity Bean: EditVendorEntity
         public EditVendorEntityKey() {  }
         public EditVendorEntityKey(String primarykey) {     
              this.primkey=primarykey;
         public String getVendorId() {
    return primkey;
         * Returns true if both keys are equal.
         public boolean equals(java.lang.Object otherKey) {
              if (otherKey instanceof code.beans.EditVendor.EditVendorEntityKey) {
                   code.beans.EditVendor.EditVendorEntityKey o =
                        (code.beans.EditVendor.EditVendorEntityKey) otherKey;
                   return (primkey.equals(otherKey));
              return false;
         * Returns the hash code for the key.
         public int hashCode() {
              return (primkey.hashCode());
    Please go through and give me your comments and solution...
    Thanks in advance
    Rahul

  • I want to use Get Panel Image in Labview 5.0.1 and need details on how to save the BMP data generated

    I am trying to generate an application that saves a copy of its front panel on completion. This is easy to do using an invoke node with Print VI to HTML but this does not work in an .exe format. I have seen elsewhere that you have to use the Get Panel Image method, but no details are supplied in LV 5.0.1 documentation of how to use the "image" data (1-D Unsigned Byte array) that is generated. I want to save this in a format that can then be read as a bitmap in any standard graphics package. Any assistance?

    Hi,
    If you'd upgrade to LV5.1 or 6 you could use the 'standard' vi's for this.
    You need a VI called "Write BMP File.vi". It's not shipped with LV5.0.1.
    This vi only uses 3 subVI's, so perhaps someone at NI can convert it and
    send it to you (sorry, I won't, it's copywrited).
    If you cannot get this VI anywhere, you'll need to figure out the BMP file
    format yourself. It's not too complicated, but still could take some days.
    Perhaps someone figured it out before LV5.1 was released.
    Regards,
    Wiebe.
    "RDK" wrote in message
    news:[email protected]..
    > I want to use Get Panel Image in Labview 5.0.1 and need details on how
    > to save the BMP data generated
    >
    > I am trying to generate an application that saves a copy
    of its front
    > panel on completion. This is easy to do using an invoke node with
    > Print VI to HTML but this does not work in an .exe format. I have seen
    > elsewhere that you have to use the Get Panel Image method, but no
    > details are supplied in LV 5.0.1 documentation of how to use the
    > "image" data (1-D Unsigned Byte array) that is generated. I want to
    > save this in a format that can then be read as a bitmap in any
    > standard graphics package. Any assistance?

  • How do I insert into an array only if the condition is true?

    I am buiding an array made up of pairs of data from a file. I am going through line by line putting the values in an array and then taking the pairs of two indexes oring them and putting the number into another array. I do not know if there is more than one set on each line so I have to do a while loop to check.The problem is I have to get the indexes in pairs, so for example I take in the element from index 0 and 1 and or them index 2 and 3 and or them, I do not need the combination of 1 and 2 or 3 and 4 and etc. I am using the "Quotient & Remainder" to check if the index is even or odd, if it is even I take that element and the very next index's element, I or them and put them in another array, but if i
    t is odd I do not want to put anything into the array. How can I go about doing that? Any help would be appreciated. I am using version 6.1 Thanks, Molly
    Attachments:
    labview.bmp ‏3841 KB

    Molly,
    Rather than running while loop which only executes code every other time you could instead just do a little more math to get your index values. Just multiply the iterator (i) terminal by 2 for the first index and then add 1 to it for the second (you'd need to run the loop half as many times of course). This would be more efficient and easier to read in your code. One other tip is that when you are running a loop a specified number of times it's cleaner to use a for loop rather than a while loop.
    Regards,
    Ryan K.
    NI

  • Setting attributes of image stored in byte array in servlet

    Hi,
    I am using a servlet to stream image (GIF) to the browser.
    Image is accessed by browser using the img tag. src attribute points to the servlet which send the image stream.
    Servlet has the image as the array of bytes. It simply write these bytes on the response object's output stream. It does not use any encoder.
    I get the image on the browser. But when I try to see the properties of the image I don't see the type of image. I also don't see the created time, modified time and size of the image. When I do Save As on this image it tries to save it as BMP instead of GIF. Also when I do the print preview I don't see the image in the preview window. When I try to print the web page, it prints everything except this image. I get small cross(image missing) on the printed page.
    I would like to know why the image attributes on browser go missing and why can't I print the image?
    I would like to add that I am getting the image as the array of bytes from a different application on which I do not have control.
    Thanks.

    Hi,
    I am using a servlet to stream image (GIF) to the browser.
    Image is accessed by browser using the img tag. src attribute points to the servlet which send the image stream.
    Servlet has the image as the array of bytes. It simply write these bytes on the response object's output stream. It does not use any encoder.
    I get the image on the browser. But when I try to see the properties of the image I don't see the type of image. I also don't see the created time, modified time and size of the image. When I do Save As on this image it tries to save it as BMP instead of GIF. Also when I do the print preview I don't see the image in the preview window. When I try to print the web page, it prints everything except this image. I get small cross(image missing) on the printed page.
    I would like to know why the image attributes on browser go missing and why can't I print the image?
    I would like to add that I am getting the image as the array of bytes from a different application on which I do not have control.
    Thanks.

  • Problem in reading BMP file .....

    I've facing some inconsistency in reading BMP headers. There are two of them, and I've outlined them below....
    Here's a description of the BMP headers, just for refreshing ....
    1.
         typedef struct {
         BITMAPFILEHEADER bmfHeader;
         BITMAPINFOHEADER bmiHeader;
         GLubyte *image_data;
         } BITMAP_IMAGE;
         typedef struct tagBITMAPFILEHEADER {
              WORD bfType;               // 2B
              DWORD bfSize;               // 4B
              WORD bfReserved1;     // 2B
              WORD bfReserved2;     // 2B
              DWORD bfOffBits;          // 4B
         } BITMAPFILEHEADER, *PBITMAPFILEHEADER;
         typedef struct tagBITMAPINFOHEADER{
         DWORD biSize;
         LONG biWidth;
         LONG biHeight;
         WORD biPlanes;
         WORD biBitCount;
         DWORD biCompression;
         DWORD biSizeImage;
         LONG biXPelsPerMeter;
         LONG biYPelsPerMeter;
         DWORD biClrUsed;
         DWORD biClrImportant;
         } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
    2. The file I'm reading test2.bmp has the following parameters
         File Type                     Windows 3.x Bitmap (BMP)
         Width                         4
         Height                         4
         Horizontal Resolution     96
         Vertical Resolution          96
         Bit Depth                    24
         Color Representation     True Color RGB
         Compression                    (uncompressed)
         Size                         102 bytes
         Size on disk               4.00 KB (4,096 bytes)
    3. Output of the program is....
              File Headers are...
              bfType :424d
              bfSize :102
              bfReserved1 :0
              bfReserved2 :0
              bfOffBits :54
              File Info Headers are...
              biSize :40
              biWidth :4
              biHeight :4
              biPlanes :0
              biBitCount :1
              biCompression :1572864
              biSizeImage :48
              biXPelsPerMeter :196
              biYPelsPerMeter :234881220
              biClrUsed :234881024
              biClrImportant :0
    4.      readInt()     4
              Reads four input bytes and returns an int value.
         readUnsignedShort()     2
              Reads two input bytes and returns an int value in the range 0 through 65535.
         readByte()
              Reads one Byte
    5. The bfType fields value should be 'BM' whose Hex is 0x4D42 according to this link
    http://edais.earlsoft.co.uk/Tutorials/Programming/Bitmaps/BMPch1.html
    But the Hex I get is 424d.How come ?
    6. When reading bfSize (see ## ), we should read 4 bytes as per the above structure. But I don't
    get the answer of 102 when I do readInt() (which reads 4B). On the contrary, when I do
    readByte(), thats when I the right file size of 102.
    Why ?
    Rest all the output look ok.
    import java.io.*;
    class BMPReader{
         private byte data[];
         private DataInputStream dis = null;
         public BMPReader(String fileName){
              readFile(fileName);
         private void readFile(String fileName){
              try{
                   dis = new DataInputStream(new FileInputStream(new File(fileName)));
              catch(Exception e){
                   System.out.println(e);
         public void printFileHeader(){
              System.out.println("File Headers are...");
              try{
                   // converting the 2 bytes read to Hex
                   System.out.println("bfType :" + Integer.toString(dis.readUnsignedShort(),16));
                   System.out.println("bfSize :" + dis.readInt());
                   //System.out.println("bfSize :" + dis.readByte());// ## identifier, should read 4B here instead of 1B
                   System.out.println("bfReserved1 :" + dis.readUnsignedShort());     // bfReserved1
                   System.out.println("bfReserved2 :" + dis.readUnsignedShort());     // bfReserved2
                   System.out.println("bfOffBits      :" + dis.readInt());               // bfOffBits
              catch(Exception e){
                   System.out.println(e.toString());
         public void printFileInfoHeader(){
              System.out.println();
              System.out.println("File Info Headers are...");
              try{
                   System.out.println("biSize           :" + dis.readInt());                         //DWORD
                   System.out.println("biWidth      :" + dis.readInt());                     //LONG
                   System.out.println("biHeight      :" + dis.readInt());                     //LONG
                   System.out.println("biPlanes      :" + dis.readUnsignedShort());          //WORD
                   System.out.println("biBitCount      :" + dis.readUnsignedShort());     //WORD
                   System.out.println("biCompression     :" + dis.readInt());               //DWORD
                   System.out.println("biSizeImage      :" + dis.readInt());               //DWORD
                   System.out.println("biXPelsPerMeter :" + dis.readInt());          //LONG
                   System.out.println("biYPelsPerMeter :" + dis.readInt());          //LONG
                   System.out.println("biClrUsed          :" + dis.readInt());                    //DWORD
                   System.out.println("biClrImportant      :" + dis.readInt());               //DWORD
              catch(Exception e){
                   System.out.println(e.toString());
    public class BMPReadForum{
         public static void main(String args[]){
              String fName = "test2.bmp";
              BMPReader bmpReader = new BMPReader(fName);
              bmpReader.printFileHeader();
              bmpReader.printFileInfoHeader();
    }

    I stumbled across this thread while messing with numbers coming out of my palm (via pilot-xfer) that are unsigned 32 bit values read into a 4 element byte array. I would very much like to turn these things into longs. I looked over the above posted code (for which I am most grateful) and made some alterations that seemed prudent, would someone be so kind as to verify that this is doing what I would like it to do?
    private long makeUInt(byte[] b) {
        // Convert a four byte array into an unsigned
        // int value. Created to handle converting
        // binary data in files to DWORDs, or
        // unsigned ints.
        long result = 0;
        int bit;
        int n = 0;    // I assumed this was the power to take the base to - 0 for lsb
        // I further assumed that we need to move backwards through this array,
        // as LSB is in the largest index, is this right?
        for (int a=3; a >= 0; a--) {
            // Similarly, I need to step through this backwards, for the same
            // reason
            for (int i=7; i >= 0; i--) {
                bit = b[a] & 1;
                result += bit * Math.pow(2, n++);
                b[a] >>>= 1;
        return result;
    }So, as you see - I assumed the "n" term was a count for what power of 2 we were in in the bit string, and I further assumed that, since for me the MSB is in the byte array element with the largest index, I needed to work backwards through this thing.
    Does this seem reasonable?
    Thanks a lot
    Lee

  • How do I initialize an array after getting xml data via httpservice?

    I am having a problem trying to initialize an array with data from an external xml file obtained via httpservice.  Any help/direction would be much appreciated.  I am using Flex 4 (Flash Builder 4).
    Here is my xml file (partial):
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Root>
        <Row>
            <icdcodedanddesc>00 PROCEDURES AND INTERVENT</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.0 THERAPEUTIC ULTRASOUND</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.01 THERAPEUTIC US VESSELS H</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.02 THERAPEUTIC ULTRASOUND O</icdcodedanddesc>
        </Row>
    </Root>
    Here is my http service call:
    <s:HTTPService id="icdcodeservice" url="ICD9V2MergeNumAndDescNotAllCodes.xml"
                           result="icdcodesService_resultHandler(event)" showBusyCursor="true"  />
    (I have tried resultFormat using object, array, xml).
    I am using this following Tour de Flex example as the base -http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500
    and updating it with the httpservice call and result handler.  But I cannot get the data to appear - I get [object Object] instead.  In my result handler code  I use "icdcodesar = new Array(event.result.Root.Row);"  and then "icdcodesar.refresh();".
    The key question is: How to I get data from an external xml file into an array without getting [object Object] when referencing the array entries.  Thanks much!
    (Tour de Flex example at http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500  follows)
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:local="*"
                   skinClass="TDFGradientBackgroundSkin"
                   viewSourceURL="srcview/index.html">
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace local "*";
            s|Label {
                color: #000000;
        </fx:Style>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                private var names:ArrayCollection = new ArrayCollection(
                    ["John Smith", "Jane Doe", "Paul Dupont", "Liz Jones", "Marie Taylor"]);
                private function searchName(item:Object):Boolean
                    return item.toLowerCase().search(searchBox.text) != -1;
                private function textChangeHandler():void
                    names.filterFunction = searchName;
                    names.refresh();
                    searchBox.dataProvider = names;
                private function itemSelectedHandler(event:SearchBoxEvent):void
                    fullName.text = event.item as String;   
            ]]>
        </fx:Script>
        <s:layout>
            <s:HorizontalLayout verticalAlign="middle" horizontalAlign="center" />
        </s:layout>
        <s:Panel title="Components Samples"
                 width="600" height="100%"
                 color="0x000000"
                 borderAlpha="0.15">
            <s:layout>
                <s:HorizontalLayout horizontalAlign="center"
                                    paddingLeft="10" paddingRight="10"
                                    paddingTop="10" paddingBottom="10"/>
            </s:layout>
            <s:HGroup >
                <s:Label text="Type a few characters to search:" />
                <local:SearchBox id="searchBox" textChange="textChangeHandler()" itemSelected="itemSelectedHandler(event)"/>
            </s:HGroup>
            <mx:FormItem label="You selected:" >
                <s:TextInput id="fullName"/>
            </mx:FormItem>
        </s:Panel>
    </s:Application>

    Hello,
    Instead of extracting the first zero element from the vid array, you should take that out and connect it allone.
    Attachments:
    init.bmp ‏339 KB

  • Import an image to black&white into array

    Hello there.
    I'm making a type of cutter, that cuts stamps out of potatos. Currently, the pattern is an array of booleans of 25x25, where you have to click what you want to see and then the program cuts it out. We'd like to add more functionality though, perhaps by allowing images to be imported and these should then get put in the array, according to black/white-scale.
    I have absolutly no idea how I'd start doing anything like this.
    Thanks in advance!

    Hi,
    You should use the File Dialog VI. Provide it with a promt name (appears in the windows bar). pattern label (image type name), file patern (extention like *.bmp or *.jpg) and a start path (folder you would like to start in). You will now get a popup which starts in the folder you provided and limits to the extention you provided. Se VI attached (LV 2011) for an example.
    What falkpl ment with VDM is Vision Development Module. This is an addon which you can install onto LabVIEW. It gives you a large library of VIsion functions to work on your images. For more info goto:
    Vision Development Module
    NI IMAQ is a driver for our Frame Grabbers to capture images from cameras.
    Hope this helps. Have a nice day
    Rik Prins, CLD
    Applications Engineering Specialist Northern Europe, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
    Attachments:
    Select file.vi ‏24 KB

Maybe you are looking for

  • Adobe Muse Gallery Widgets

    Hi Everyone I am not able to figure out how to use the widgets which I downloaded from the Adobe Muse Website ( Widget Gallery). It seems that they cannot be dragged and dropped into the site I am creating. I finally doubled clicked on one of them an

  • HT1386 How do I transfer all the music from an iTunes library on a PC to on another iTunes library on a Mac, with being able to keep both libraries of music?

    A year and a half ago I purchased an iPhone 4s and created a substantial library of music in the iTunes account on my PC. Just recently, I purchased a Macbook Pro w/ Retina  and am just getting around to syncing the newer iTunes library on my iPhone.

  • LSMW through t.code F-02

    HI I am trying to Upload the data through LSMW using the T.code (F-02).Which method will be succefully upload the data. In the LSMW two different process two upload the data. (1) Driect batch input /standard  batch input or (2) batch input recording

  • G710 headphone jack not working

    Hi, the headphone jack on my G710 does not seem to be working. I tried two different headphones, no luck.  I get a message "jack is now plugged in", the speakers turn off but no audio in the headphones. Latest driver (win 8.1 64) has been installed a

  • Embedding a WIMPY jukebox into a flash page?

    Hi, I would like to insert a WIMPY jukebox (or a section of html if we're talking technically here) into a .swf file. I have a flash template, and inserting the player into the HTML page is useless and messy and troublesome. Is there a way of inserti