MathGroup Archive 2005

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

Search the Archive

Displaying Images on GUI during run time

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

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.
   Widget["Frame", {"title" -> "Segmentation GUI",
             {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",
     Script[imgPath = ToString[
         Widget["FileDialog", Name -> "openFileDialog"];
           SetPropertyValue[{"openFileDialog", "multiSelectionEnabled"}, 
           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], 
}, 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.


  • 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