LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check out this program I made in LabVIEW!

Highlighted

I made an interesting program in LabVIEW. By the way, I got my copy of LabVIEW from the University of Washington. The interesting thing is their student software site (known as UWare) offers students software with discounts, but LabVIEW 8.5.1 (an older version, 'cause the current version is 8.6) was actually offered for FREE! And on top of that the serial number their site gave me, when used with the NI License Manager actually gave me an activation code that when used unlocked the Professional Development version! Wow! I was expecting it to only unlock the student version. But it seriously unlocked the PROFESSIONAL DEVELOPMENT version! In fact later when I looked, I saw that the conformation email I got from NI (after activating it with the serial number the UW gave) me actually said in a line of text near the activation code that the code was SUPPOSED to activate the Professional Development version. All I can say is WOW! Either they had a glitch, or NI is now willing to just give away the Professional Development version software (at least of the older version, which is 8.5.1) through universities.

 

But getting back on topic. I made this really cool program with it and built a standalone executable (a feature that probably isn't in the student version). It allows you to view an image at different bit layers (such as viewing the image data contained in the 5th bit of each pixel). It also allows you to save this output image. I've attached the a zip file containing the program to this message. The zip file includes (in addition to the program's EXE file) an INI file and an ALIASES file. These were generated when the program was built, but I'm not sure if they are needed, because when I moved the program to another directory it still ran. However I've included them in the zip file anyway, just in case they are needed.

 

By the way, the program can only handel BMP, JPG, and PGN files. There were image loading modules for only those 3 file types. So sorry, but I can't figure out how to get it to load GIF files or PCX files.

Message Edited by Ben321 on 11-14-2008 09:39 PM
Message Edited by Ben321 on 11-14-2008 09:41 PM
0 Kudos
Message 1 of 24
(2,508 Views)
Highlighted

Looks like your university has a campus agreement.

 

Anyway, we typically share code here and don't just parade executables. 😮

 

I have not tried your program, because there is no way to tell if it does not contain any malicious code that e.g. would erase the files on my HD. I would feel much more comfortable looking at the VIs instead. Once you have a few yellow bars next to your name this might change. 🙂

 

Can you at least attach a screenshot of the front panel?


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 24
(2,494 Views)
Highlighted

altenbach wrote:

Looks like your university has a campus agreement.

 

Anyway, we typically share code here and don't just parade executables. 😮

 

I have not tried your program, because there is no way to tell if it does not contain any malicious code that e.g. would erase the files on my HD. I would feel much more comfortable looking at the VIs instead. Once you have a few yellow bars next to your name this might change. 🙂

 

Can you at least attach a screenshot of the front panel?


A campus agreement? COOL!. That's good to know, because I was afraid that somehow my university's computer system might have been hacked or something, and then maybe malware on it was acting as an illegal keygen for the software. I'm glad to know that my computer is safe, because if my campus has been hacked, then anytime I log-in to check my grades or my class schedule my own computer is at risk of being hacked. So BIG THANKS for clearing that up. I'm so glad to know that my computer and the computers at the university I attend are safe.

 

As for my software, I have NO malware in the program I made, but if I shouldn't have posted the executable, I'm sorry. My bad.

 

In this message I have included the VI file. And also I have separately included the LVPROJ project file so that you can build an executeable from the VI with the exact same specs as the one on my computer.

Message Edited by Ben321 on 11-15-2008 12:45 AM
Download All
0 Kudos
Message 3 of 24
(2,483 Views)
Highlighted

You should clear your wires and place your functions better.

It will make the code more readable and it will help you build bigger code, in the future.

0 Kudos
Message 4 of 24
(2,475 Views)
Highlighted

Hi Ben,

 

some positive critsism on your VI.

About the Front panel, you made it auto-resizing with a Dialoglook. Very good, but expand the Dialog look even further. Replace the Radio button by System Radio buttons. You couldreplace the numeric with a system numeric.

 

About the block diagram, your VI will consume all the power of the computer, better use an event structure, or use the 'Wait for Front Panel activity' function to prevent such behaviour.

 

The wiring of the BD is just sloppy, right to left, behind structures, could be made much cleaner easily. (below an example of the 8.6 auto-clean up version of the code)

 

You have no way of ending your program, the stop button is not a good way to terminate a program especially if you are doing file IO (like you do), it could result in locked files.

Anyway nice that you enjoy LabVIEW and keep up the good work.

 

Ton

Message Edited by TonP on 11-15-2008 08:17 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 24
(2,474 Views)
Highlighted

I agree, not bad for a first effort. 🙂

 

A few more simple comments:

 

  • As Ton already mentioned, your VI spins like crazy, constantly reading the same file and doing the same calculation over and over, millions of times per second. The loop only needs to spin if an input changes. An event structure is ideal for this. (Or at least place a 100ms delay inside your loop).
  • There is an "empty path?" primitive in the comparison palette, so you don't need the conversion to string and comparison with an empty string.
  • The "File ext" function belongs inside the case structure, because you don't need it if the path is empty.
  • The "draw flattened bitmap" belongs outside the case. You only need one instance. Code that is the same in all cases belongs outside the case structure.
  • You should change the labels of the items in the radio button control (even if you don't show them). They will show up in the case selector. A proper choice is important for documentation.
  • The extracted bit layer does not need to be calculated if you show the full image.
  • Your path controls should be wider. They are very cramped to use.
  • Using an event structure makes things much simpler.
  • Never (almost) use switch until released as mechanical action for a button. You'll trigger multiple iterations in fast loops. Use latch when released.
  • I did not verify your math. You probably need more code to reasonably deal with different color depths.

 

Anyway, here's a very rough draft, only showing some of the suggestions. Modify as needed. Many things need to be improved. Good luck!

 

Message Edited by altenbach on 11-15-2008 12:39 AM

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Download All
Message 6 of 24
(2,464 Views)
Highlighted

TonP wrote:

Hi Ben,

 

some positive critsism on your VI.

About the Front panel, you made it auto-resizing with a Dialoglook. Very good, but expand the Dialog look even further. Replace the Radio button by System Radio buttons. You couldreplace the numeric with a system numeric.

 

About the block diagram, your VI will consume all the power of the computer, better use an event structure, or use the 'Wait for Front Panel activity' function to prevent such behaviour.

 

The wiring of the BD is just sloppy, right to left, behind structures, could be made much cleaner easily. (below an example of the 8.6 auto-clean up version of the code)
 

You have no way of ending your program, the stop button is not a good way to terminate a program especially if you are doing file IO (like you do), it could result in locked files.

Anyway nice that you enjoy LabVIEW and keep up the good work.

 

Ton

Message Edited by TonP on 11-15-2008 08:17 AM

 

 

 

The reason I set it up the way I did was in expectation of putting it into a standalone executable file. I made the settings in it so that there would NOT be a stop or run button in the executable. Instead it would start when I ran the exe file, and it would stop when I clicked the X button in the upper right corner of the window to close the program. I also removed the menu bar for the same reason. In  the menu bar of the executable there were LOTS of features that had NOTHING to do with my program (such as logging onto a remote panel). I couldn't see how to delete individual menu items in the settings for my executable, so I just disabled the menu bar in it.

 

That is why it has a "dialog" look. I NEVER intended it to be a dialog, but simply it's supposed to be an ORDINARY Windows Application. As such I don't need to use "system" radio buttons. I can just use whatever style (or mixture of styles) of controls that I like.

0 Kudos
Message 7 of 24
(2,427 Views)
Highlighted

altenbach wrote:

I agree, not bad for a first effort. 🙂

 

A few more simple comments:

 

  • As Ton already mentioned, your VI spins like crazy, constantly reading the same file and doing the same calculation over and over, millions of times per second. The loop only needs to spin if an input changes. An event structure is ideal for this. (Or at least place a 100ms delay inside your loop).
  • There is an "empty path?" primitive in the comparison palette, so you don't need the conversion to string and comparison with an empty string.
  • The "File ext" function belongs inside the case structure, because you don't need it if the path is empty.
  • The "draw flattened bitmap" belongs outside the case. You only need one instance. Code that is the same in all cases belongs outside the case structure.
  • You should change the labels of the items in the radio button control (even if you don't show them). They will show up in the case selector. A proper choice is important for documentation.
  • The extracted bit layer does not need to be calculated if you show the full image.
  • Your path controls should be wider. They are very cramped to use.
  • Using an event structure makes things much simpler.
  • Never (almost) use switch until released as mechanical action for a button. You'll trigger multiple iterations in fast loops. Use latch when released.
  • I did not verify your math. You probably need more code to reasonably deal with different color depths.

 

Anyway, here's a very rough draft, only showing some of the suggestions. Modify as needed. Many things need to be improved. Good luck!

 

Message Edited by altenbach on 11-15-2008 12:39 AM

My VI DOES have enough code to extract the desired bits. It has NOTHING to do with bit-depth. Pictures have 8 bits per pixel (if greyscale or indexed color) and 8 bits per channel per pixel (if RGB color). So this can extract the 0th bit layer all the way up to the 7th bit layer. OF COURSE it doesn't extract more than one bit layer at a time.

 

As for the code you used what is the box that looks like a filmstrip on the left of window? Is that just a way of dividing your code up into easily understandable sections? Or does it serve some actual purpose?

And on the right, what is that box that has a hatchmarked edge? In the upper left of that box is an hourglass, and in the lower left it has the word "source". What are these indicators and how do they work? And why does the right side of that box have a connector that seems to be attached to nothing on the inside, but on the outside is attached to the stop function for the "while" loop?

 

Please explain the purpose of your different objects in your program, as they are things I've not yet used in my program, and I'm not familiar with how to use them.

Message Edited by Ben321 on 11-15-2008 02:36 PM
0 Kudos
Message 8 of 24
(2,427 Views)
Highlighted

Hi Ben,

you sound agitated, hope we don't have that effect on you. Smiley Sad

About the code that Altenbach has posted.

The first part (left) is a sequence, it makes sure everything inside the sequence is done before the second part (right) is activated.

 

The second part is an event structure (not available in LabVIEW base, what you might have), the event structure makes sure the while loop only spins when the path of 'Input File' has changed.

 

To remove the menu bar of any VI, go to the VI properties (ctrl-i), use the drop down box to select 'Appearance', select customize, and there you have a lot of options dealing with the appearance of your VI, including scroll bard, menu bars, minimize, maximize buttons. By selecting 'Dialog' a lot of items are preselected.

 

It is advisable to have an event structure (if you have it available), and make sure that the event structure is listening for an 'This VI, Close?' event so you can properly shut down your VI.

 

Good luck, and have fun.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 9 of 24
(2,420 Views)
Highlighted

Ben321 wrote:

My VI DOES have enough code to extract the desired bits.


 Sure, but I was just wondering how useful it is. 🙂 It might be more useful to extract the level of a single color channel for 24 bit images. For color mapped images, the bit levels are not very special, because they depend on the color map assignment. You might as well write code to extract any single color.


Ben321 wrote:

As for the code you used what is the box that looks like a filmstrip on the left of window? Is that just a way of dividing your code up into easily understandable sections? Or does it serve some actual purpose?


 This is a flat sequence frame and it is actually not needed here. In an earlier draft I had this part behind the event structure and there it was needed to prevent reading the two terminals until the event structure has fired. Sequences are used in rare cases where dataflow cannot enforce correct execution order.


Ben321 wrote:

And on the right, what is that box that has a hatchmarked edge? In the upper left of that box is an hourglass, and in the lower left it has the word "source". What are these indicators and how do they work? And why does the right side of that box have a connector that seems to be attached to nothing on the inside, but on the outside is attached to the stop function for the "while" loop?


This is an event structure. The output tunnel is set to "use default if unwired" so all other cases will output a false, keeping the loop running.

 

The hourglass is used to wire a timeout value (in cases where a timeout case is used) and the "source" is an event terminal. You can resize it for more features. Here you can get information about the event that just happened. E.g. in a "value changed" event for a numeric control, you could get the old and new values if desired. In my code these are not used.

 

You can right-click on any structure and select "help" to get more information. You can also enable the context window (ctrl+h) and you'll get more information on anything you hover over with the mouse.

 

These are all good questions and I'm sure you'll learn fast once get get the hang of things and see the full power of all the available tools. 🙂


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 10 of 24
(2,419 Views)