[Date Index]
[Thread Index]
[Author Index]
Re: Undocumented functions for working with graphics
*To*: mathgroup at smc.vnet.net
*Subject*: [mg101223] Re: Undocumented functions for working with graphics
*From*: David Reiss <dbreiss at gmail.com>
*Date*: Sat, 27 Jun 2009 06:03:18 -0400 (EDT)
*References*: <h0qogh$kkq$1@smc.vnet.net> <h0sbok$h8i$1@smc.vnet.net>
Wolfram uses various internal contexts to organize their work. So the
"real meaning" is just just as if you were organizeing your work in
private contexts as when you create a Mathematica package using
BegnPackage["mycontext`"] and Begin["`Private`"].
If you looked at your code using ?? once such a package is loaded then
you will see the internal, Private`, context variables with the
explicit mycontext`Private` contexts explicitly shown.
How Wolfram actually organizes their various internal development
contexts is something that I don't know about (I could probably find
out, but I have not ever developed anything on that level for
Wolfram). My guess is that those contexts date back to Mathematica
version 1.0.
Best,
David
On Jun 26, 6:50 am, Alexey <lehi... at gmail.com> wrote:
> Thank you again!
> But how can I understand the real meaning of such variables (?) as
> Image`ImageDump`cf, Image`ImageDump`list etc.?
>
> On 25 Jun, 15:09, David Reiss <dbre... at gmail.com> wrote:
>
>
>
> > Hi there...
>
> > When I posted the result to MathGroup, I did edit it a bit to remove
> > the Image`ImageDump` context prefixes so that it would be easier to
> > read. I simply did a global replace for the string Image`ImageDump`
> > so that the resulting code fragment would be more readable.
>
> > These bits of code that are high level Mathematica code often have
> > these various contexts in them based on how Wolfram research handles
> > internal not-for-general-consumption Mathematica code.
>
> > Also some folks may have noticed that one gets a different answer if
> > one tries to obtain the code in a fresh Mathematica session. This is
> > because the code in some of these these contexts is not loaded until
> > one actually tries to first make use fo the function.
>
> > So, for example, executing something like
>
> > Image[ {{0, 1, 0}, {1, 0, 1}, {0, 1, 0}}]
>
> > Will load that code and then subsequently going through the process
> > that I outlined will create the code that I showed.
>
> > Best,
>
> > Davidhttp://scientificarts.com/worklife
>
> > On Jun 24, 6:34 am, Alexey <lehi... at gmail.com> wrote:
>
> > > Thank you very much! The method you have described is great. Some
> > > times for using it I must launch Mathematica with "-cleanStart" key
> > > for clearing the dump. But for Image`ToGraphicsRaster I can not get
> > > your "clear" code. My result contains unknown functions like
> > > Image`ImageDump`list with no attributes:
>
> > > In[1]:= ClearAttributes[Image`ToGraphicsRaster, {Protected,
> > > ReadProtected}]
> > > ?Image`ToGraphicsRaster
>
> > > Output:
>
> > > Image`ToGraphicsRaster[Image`ImageDump`list:{_?
> > > Image`ValidImageQ..}]:=Image`ToGraphicsRaster/@Image`ImageDump`list
>
> > > Image`ToGraphicsRaster[Image`ImageDump`img_?Image`ValidImageQ]:=Mod=
ul=
> e
> > > [{Image`ImageDump`width,Image`ImageDump`height,Image`ImageDump`range,=
Im=
> ag=
> > e` =
> > > ImageDump`cf,Image`ImageDump`data,Image`ImageDump`interleaving,Image`=
Im=
> ag=
> > eD =
> > > ump`imsize},
> > > {{Image`ImageDump`width,Image`ImageDump`height},Image`ImageDump`range=
,I=
> ma=
> > ge =
> > > `ImageDump`cf}
> > > =ImageData[Image`ImageDump`img,
> > > {ImageDimensions,DataRange,ColorFunction}];
> > > {Image`ImageDump`interleaving,Image`ImageDump`imsize}=
> > > {Interleaving,ImageSize}/.Options[Image`ImageDump`img]/.Options
> > > [Image];If
> > > [Image`ImageDump`interleaving===False,Image`ImageDump`data=Re=
ve=
> rs=
> > e
> > > [ImageData[Image`ImageDump`img,Interleaving->True]],Image`ImageDump`d=
at=
> a=
> > =Reverse[First
>
> > > [Image`ImageDump`img]]];Graphics[Raster[Image`ImageDump`data,{{0,0},
> > > {Image`ImageDump`width,Image`ImageDump`height}},Image`ImageDump`range=
,C=
> ol=
> > or =
> > > Function->Image`ImageDump`cf],If[Image`ImageDump`imsize===Autom=
at=
> ic=
> > ||
>
> > > Image`ImageDump`imsize===All,ImageSize->
> > > {Image`ImageDump`width,Image`ImageDump`height},ImageSize->Image`Image=
Du=
> mp=
>
> > `imsize],PlotRange->{{0,Image`ImageDump`width},
>
> > > {0,Image`ImageDump`height}}]]
>
> > > How did you get your "clear" code?
>
> > > On 12 Jun, 05:41, David Reiss <dbre... at gmail.com> wrote:
>
> > > > ...just following up on the method for reverse engineering of my
> > > > previous post, here is part of the code for ToGraphicsRaster obt=
ai=
> ne=
> > d
> > > > using that approach:
>
> > > > Image`ToGraphicsRaster[img_?Image`ValidImageQ] :=
> > > > Module[{width, height, range, cf, data, interleaving,
> > > > imsize}, {{width, height}, range, cf} =
> > > > ImageData[
> > > > img, {ImageDimensions, DataRange, ColorFunction}]; {interle=
av=
> in=
> > g,
> > > > imsize} = {Interleaving, ImageSize} /. Options[img] /.
> > > > Options[Image];
> > > > If[interleaving === False,
> > > > data = Reverse[ImageData[img, Interleaving -> True]],
> > > > data = Reverse[First[img]]];
> > > > "Graphics"[
> > > > Raster[data, {{0, 0}, {width, height}}, range,
> > > > ColorFunction -> cf],
> > > > If[imsize === Automatic || imsize === All,
> > > > ImageSize -> {width, height}, ImageSize -> imsize],
> > > > PlotRange -> {{0, width}, {0, height}}]]
>
> > > > On Jun 11, 7:06 am, Alexey <lehi... at gmail.com> wrote:
>
> > > > > Hello,
>
> > > > > Does anyone know where such functions as "Image`ToGraphicsRast=
er=
> " =
> > an=
> > > d
> > > > > "Image`PossibleImageQ" are documented. Are there other such built=
-i=
> n
> > > > > functions? At this moment I even can't imagine from where (except=
t=
> hi=
> > s
> > > > > group) I could learn that functions mentioned exist...
Prev by Date:
**Re: Re: display of graphics primitives**
Next by Date:
**Re: Re: soap films**
Previous by thread:
**Re: Undocumented functions for working with graphics**
Next by thread:
**Creating Matrix from vectors**
| |