Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Displaying Images on GUI during run time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57679] Displaying Images on GUI during run time
  • From: Goyan <goyanian at gmail.com>
  • Date: Sat, 4 Jun 2005 03:04:27 -0400 (EDT)
  • Organization: University College London
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all,

I am currently stuck on a problem using the GUIKit. I wanted to creat a 
panel to display an image. Then I want a "Open" button to get the 
filepath and displays the image in the panel. Another "Operation" button 
to process the image data and then display the final image again in the 
same panel.

I have a ImageLabel panel for image display.
GUIRun[
   Widget["Frame", {"title" -> "Segmentation GUI",
       WidgetGroup[{
           WidgetGroup[
             {Widget["Panel", {
                   Widget["ImageLabel", {"data" -> Script[ExportString[ 
ListDensityPlot[img, Mesh -> False, FrameTicks -> False, PlotRange -> 
All, AspectRatio -> Automatic, DisplayFunction -> Identity], 
   "PNG", ConversionOptions -> {"Transparency" -> GrayLevel[1]}]],
}, Name -> "imgDisplay"]

Then I created a "Open" button to get the user selected filepath and set 
the string containing the filepath to the imgDisplay (ImageLabel widget).

Widget["Button", {"text" -> "Open",
   BindEvent["mouseClicked",
     Script[imgPath = ToString[
       GUIResolve[Script[
         Widget["FileDialog", Name -> "openFileDialog"];
           SetPropertyValue[{"openFileDialog", "multiSelectionEnabled"}, 
False];
           SetPropertyValue[{"openFileDialog", fileSelectionMode"}, 
PropertyValue[{"openFileDialog", "FILES_ONLY"}]];
           returnValue = InvokeMethod[{"openFileDialog", 
"showOpenDialog"}, Null];
	  If[returnValue === PropertyValue[{"openFileDialog", "APPROVE_OPTION"}],
	  PropertyValue[{PropertyValue[{"openFileDialog", "selectedFile"}], 
"path"}], Null]]]];
	  imgTMP = Import[imgPath]ã??1, 1, All, Allã??;
	  SetPropertyValue[{"imgDisplay", "data"}, "Script[
ExportString[ ListDensityPlot[imgTMP,Mesh->False, FrameTicks->False, 
PlotRange->All, AspectRatio->Automatic,DisplayFunction->Identity], 
"PNG",ConversionOptions->{"Transparency"->GrayLevel[1]}]]"]]]
}, Name -> "openButton"]

This didnt work. I am not sure if I can do this. What is the usual 
approach to get this done?  Thank you for your time.

Goyan


  • Prev by Date: Re: Re: Re: label origin on plot
  • Next by Date: Re: NonlinearFit
  • Previous by thread: Synergetics coordinates from a tetrahedron
  • Next by thread: Re: Displaying Images on GUI during run time