OS X Quicklook plugin for pxp files?

I have found I spend quite a bit of time opening multiple pxp files trying to find a particular graph or table, and it would be great to have an OS X QuickLook plugin that could give some sort of visual preview of the pxp file's contents so experiment files could be more easily identified before opening. Alternatively, having Igor's "Recent Experiments" option have a graphical preview of sorts (similar to the OS X Spotlight menu and Google Web searches) where hovering over a listed file will show a graphical preview. Either of these approaches would be outstanding benefits for folks like myself who end up with many pxp files in our projects.

Having an .ibw preview generator would also be useful.
An immediate thought here ... take a screen snapshot of the open experiment and save that snapshot in the folder of the experiment. Even better might be a control panel or function call from within Igor that would allow you to do this and add a few comments before the image is saved.

Hmmmm ... this might be an nice add-on to SnapIt http://www.igorexchange.com/project/SnapIt. If someone would want to help me to program the screen capture + note taking parts, I can add them to the package. Gosh, OpenMeta tags too (on Mac)???

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Might have some uses, but I can see it being cumbersome now having to manage screenshots and pxp files. If a screenshot shot could be saved in a small "preview" folder in the pxp file at each save similar to how Apple's Pages program does it, then this could interface with Quicklook and be used...sort of a combination of the two features.
tkessler wrote:
... If a screenshot shot could be saved in a small "preview" folder in the pxp file at each save similar to how Apple's Pages program does it, then this could interface with Quicklook and be used...sort of a combination of the two features.


That precludes the use on Win platforms I think. In any case, I agree the QL Preview would be very nice to have. Does anyone know how to create a QL preview store it in an Igor experiment?

Alternatively, I wonder if a solution could/should be generated as a stand-alone Igor Pro experiment. Something akin to the experiment browser that allows you to search folders in experiments. Only this would search for a specific image file in a specific folder in an Igor experiment ...

root:Packages:QLPreviewer
--> snapshot (image)
--> notes (text)

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
jjweimer wrote:
tkessler wrote:
... If a screenshot shot could be saved in a small "preview" folder in the pxp file at each save similar to how Apple's Pages program does it, then this could interface with Quicklook and be used...sort of a combination of the two features.


That precludes the use on Win platforms I think. In any case, I agree the QL Preview would be very nice to have. Does anyone know how to create a QL preview store it in an Igor experiment?

Alternatively, I wonder if a solution could/should be generated as a stand-alone Igor Pro experiment. Something akin to the experiment browser that allows you to search folders in experiments. Only this would search for a specific image file in a specific folder in an Igor experiment ...

root:Packages:QLPreviewer
--> snapshot (image)
--> notes (text)

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville


Is there an Igor command to grab clipboard content and put it in a matrix or wave? If so then OS X users could set up an Igor hook to invoke a unix command to take a screenshot and save it to the clipboard, and then drop it into a wave/matrix in a particular folder so it could be retrieved by a previewing function of sorts.
tkessler wrote:
Is there an Igor command to grab clipboard content and put it in a matrix or wave? If so then OS X users could set up an Igor hook to invoke a unix command to take a screenshot and save it to the clipboard, and then drop it into a wave/matrix in a particular folder so it could be retrieved by a previewing function of sorts.


With some limitations, SavePict can store an image on the Clipboard.
I've been experimenting with SavePict and LoadPict, but can't seem to find a way to save a loaded picture from the clipboard into a wave. I can get it into Igor, but it stays in the "Picture Browser" and there seems to be no way to get it into a wave or otherwise use it, beyond interactive options like copying and pasting it into a graph or notebook. Is there a way to convert a loaded picture in the picture browser into a matrix or other data object?
tkessler wrote:
... Is there a way to convert a loaded picture in the picture browser into a matrix or other data object?


What about the alternative ... accessing the Picture Browser contents directly from outside the experiment? What format is used to store pictures in a packed experiment? What path could be used to access them either from the Mac shell or the Windows command line?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
I agree such features would be nice, but I don't know how to access them from outside of Igor. The picture loaded with the LoadPICT command is somewhere in the pxp file, but not as a wave and unfortunately not as something that's easily accessed via the Igor command prompt or data browser. They are saved with the file, so I can load one either from the clipboard or elsewhere and preserve it with the experiment, but being able to read it from the file is a different issue, and I can't seem to figure it out.
tkessler wrote:
I've been experimenting with SavePict and LoadPict, but can't seem to find a way to save a loaded picture from the clipboard into a wave. I can get it into Igor, but it stays in the "Picture Browser" and there seems to be no way to get it into a wave or otherwise use it, beyond interactive options like copying and pasting it into a graph or notebook. Is there a way to convert a loaded picture in the picture browser into a matrix or other data object?

You should use SavePict to save to a file and then use ImageLoad to get that file into a wave. Then you can delete the intermediate file.
Notebooks may provide the functionality that you are looking for and this solution is cross platform compatible.

A function could grab a list of windows, embed them in a notebook and save the notebook to disk with a name based on the experiment name. There would be another function to find notebook files on disk and permit opening them for inspection.

Another benefit is that graphics embedded in a notebook can be updated if the underlaying window is changed.

aclight wrote:

You should use SavePict to save to a file and then use ImageLoad to get that file into a wave. Then you can delete the intermediate file.


Where in the experiment is the image stored when it is captured to the picture browser from the clipboard? This pertains to how that image might then be accessed via a QuickLook plug-in on a Mac platform.

Otherwise, its seems we are heading toward creating a stand-alone Igor Pro experiment that can browse other experiments to review internal previews. The question is, should it look for a screen capture that has been saved as an image wave, or should it look for a notebook with captured images? Why not create both?

Also, could a Mac QuickLook plug-in access a notebook file in an Igor Pro experiment? Would it show for example as an RTFD file?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
tkessler wrote:
... They are saved with the file, so I can load one either from the clipboard or elsewhere and preserve it with the experiment, but being able to read it from the file is a different issue, and I can't seem to figure it out.


Me neither ... hence my query to Adam.

As near as I can tell, if you have the path to an object inside a file "container" and the format of that object, and if you have the subsequent know-how (and time/desire), you can write a QuickLook plug-in to use that object as the QL Preview.

All big ifs.

A stand-alone Igor Pro experiment "previewer" may be a safer bet to put together, even though it is not as nice as having a built-in QuickLook plug-in on the Mac.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
jjweimer wrote:
Where in the experiment is the image stored when it is captured to the picture browser from the clipboard? This pertains to how that image might then be accessed via a QuickLook plug-in on a Mac platform.

I don't believe that we have documented how pictures or notebooks/help files are stored because the format is very complicated. There is a technical note that ships with Igor that contains information about how waves are stored in a packed experiment.

I don't think Igor experiments lend themselves to a preview. They can get too complicated to distill down into a simple, usually small, image. I'm not sure that we could come up with an algorithm to generate the preview that is broadly useful. Unlike most file formats that contain one type of data (an image, text, a single document even), Igor experiments can contain any number of graphs, tables, layouts, panels, notebooks, procedure windows, etc. Storing an image preview of each window would bloat the size of the packed experiment files and would require additional time to generate the previews when saving. Say your experiment has 50 graph windows opened. Which one do you show as the preview image? If you show all of them, then the preview image must either be extremely large or each graph is shown very small.
aclight wrote:
...
I don't believe that we have documented how pictures or notebooks/help files are stored because the format is very complicated. There is a technical note that ships with Igor that contains information about how waves are stored in a packed experiment.

I don't think Igor experiments lend themselves to a preview.


OK, but what if we said, all we wanted was access to a) a specific notebook or b) a specific image wave that is contained in the experiment? And we wanted to do this from a separate Igor Pro experiment (eg, an "Experiment Previewer"). And we wanted to display the notebook or image wave as a "quick look preview" (ie, as an image).

I get the sense that, a QuickLook experiment in Igor Pro would be better to work with an image waves, since the storage format and location of notebooks is ... "very complicated" by comparison.

So, the question is, how can an Igor Pro experiment access an image wave from a different experiment and display it as a "preview picture" for that experiment? Given that, we can code a method to capture a screen shot of the experiment and store it properly as the representative preview image.

Basically, I think the Previewer experiment would be ...

* get file list of all .pxp files on a users hard drive
* present the user with a method to select a specific experiment
* search the chosen .pxp file for the existence of a specific image wave (root:Packages:QLPreviewer:image)
* show that wave (if it exists) as an image


An additional question is, could a QuickLook plug-in be built (on the Mac) to access that same wave image? This is beyond my user-level rating.

Or, we just wait for Igor 7 to have this built-in. :-)

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
jjweimer wrote:

So, the question is, how can an Igor Pro experiment access an image wave from a different experiment and display it as a "preview picture" for that experiment? Given that, we can code a method to capture a screen shot of the experiment and store it properly as the representative preview image.

You can use the LoadData operation to load a wave from another experiment. You could then create a new image in the "preview" experiment showing that wave. But you'd need to first actually load the wave into the "preview" experiment.

jjweimer wrote:

An additional question is, could a QuickLook plug-in be built (on the Mac) to access that same wave image? This is beyond my user-level rating.

Probably, but it wouldn't be easy. The plugin would need to open the experiment file, find any image data, and then treat that image data as, for example, png data to create a png preview.

jjweimer wrote:

Or, we just wait for Igor 7 to have this built-in. :-)

None of the problems with implementing a quick look plugin change in Igor 7. So I wouldn't recommend holding your breath.
For what it's worth, I uploaded a small project (http://www.igorexchange.com/project/JTG_ExperimentPreview) recently to try to address this. It does not fill the OP desire to have this work at, say, the OS file browser level; instead, it functions entirely within Igor and is cross platform compatible.

The posted version saves all open graphs in the current experiment in a notebook and saves the notebook to disk. There is a panel that can be used to quickly browse these (or any) notebook files saved to disk.

By the way, Asylum Research does have a helper program that works with Windows Explorer (there may also be a Mac version, but I'm not sure) to show a thumbnail for ibw files that their Igor software writes. It's quite slick it that it also adds a tab to the properties dialog which can be uesd to view all images stored in the file as well as parameters used to acquire the data. When the mouse hovers over a file in WE a subset of those parameters are displayed.

Hope this helps.
Looks good! Thanks for the quick script. I'll try to play around with the "BeforeExperimentSaveHook" hook function to have this be done automatically when the experiment is saved.
jtigor wrote:
For what it's worth, I uploaded a small project (http://www.igorexchange.com/project/JTG_ExperimentPreview) recently to try to address this. It does not fill the OP desire to have this work at, say, the OS file browser level; instead, it functions entirely within Igor and is cross platform compatible.

The posted version saves all open graphs in the current experiment in a notebook and saves the notebook to disk. There is a panel that can be used to quickly browse these (or any) notebook files saved to disk.

By the way, Asylum Research does have a helper program that works with Windows Explorer (there may also be a Mac version, but I'm not sure) to show a thumbnail for ibw files that their Igor software writes. It's quite slick it that it also adds a tab to the properties dialog which can be uesd to view all images stored in the file as well as parameters used to acquire the data. When the mouse hovers over a file in WE a subset of those parameters are displayed.

Hope this helps.


This project of yours works quite well, but as it is the project keeps an external notebook file in the same directory as the experiment, which makes organizing experiments in the filesystem a touch cumbersome. Therefore, I've reworked it a bit to have the script keep the notebook previews in a central location and keep track of them with a UUID that matches a generated UUID string stored in the experiment.

With these changes the script will list the pxp files in the specified folder (instead of the notebook previews), and when you select one it will access the UUID stored in the pxp and match it to the appropriate preview file (or display "No Preview Available" if a preview has not yet been generated).

Furthermore, if you double-click the file in the preview panel then Igor will open it (or if you hold the Option key while doing this then Igor will reveal that experiment file in the Finder).

In addition, I've included a hook to generate the UUID and a preview for each experiment when it is saved (and tucked the notebook generation into the background), so this will be done automatically for any newly saved experiments and users will only see Igor take a split second longer to save when they press Command-S.

Lastly, I've altered the menu items a bit to be one entry only in the File menu that shows the preview browser panel by default, but if you hold the Option key then the menu entry will switch to "Generate Preview," which will create a UUID (only if one does not currently exist) and corresponding preview notebook file for the current experiment.

I've also reorganized the interface a touch.

Unfortunately some of these modifications tap into the OS X BSD layer via Igor's "ExecuteScriptText" command to run "do shell script" and execute the CLI tools "uuidgen" and "open." If there are equivalents in Windows then this can be used for Windows machines as well, but as it is, because of these requirements it's limited to OS X.

Pardon any funky programming approaches, but it should work nicely (at least for OS X users). I'm currently running OS X 10.8, but I believe the uuidgen and open commands are present in all versions of OS X supported with Igor 6. I've only tested this in Igor 6.3, but I expect it will work in recent older versions as well.

I've attached the modified ipf file and a screenshot of the preview browser.
I like the direction you took with this. It makes quite a bit of sense.

tkessler wrote:
In addition, I've included a hook to generate the UUID and a preview for each experiment when it is saved (and tucked the notebook generation into the background), so this will be done automatically for any newly saved experiments and users will only see Igor take a split second longer to save when they press Command-S.
<Snip>
Unfortunately some of these modifications tap into the OS X BSD layer via Igor's "ExecuteScriptText" command to run "do shell script" and execute the CLI tools "uuidgen" and "open." If there are equivalents in Windows then this can be used for Windows machines as well, but as it is, because of these requirements it's limited to OS X.


There seems to be versions of uuid.exe available for Windows, but they are not standard issue. Still, this might be made cross platform compatible by rolling one's own version of a (relatively) unique identifier. Perhaps an ID could be based on the file name and system time. This should be unique on the computer one is working on, but there is no guarantee that it will be universally unique.

Additionally, the "previewed" experiment can be opened on Windows either using the operation que (Execute/P) or ExecuteScriptText. Execute/P can be used to open the experiment in the existing instance of Igor and ExecuteScriptText can do this or open a second instance of Igor with the experiment.