MathGroup Archive 2009

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

Search the Archive

Re: Problem in generating a IF cycle which Mathematica 6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95579] Re: Problem in generating a IF cycle which Mathematica 6.0
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 22 Jan 2009 06:58:46 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gl71vm$c7d$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

you had posted the code before and you have
ignored all of our suggestions, that gave me the
hope that you will ignore the next answers too

SetDirectory["C:\\Users\\proprietario\\Desktop\\Desktop\\TESI\\Dati\\\Bitmap\\\Paziente
  1"];
nome = "p6.bmp";
gv=Import[nome]/. {img_Image:> Flatten[ImageData[img]],
                    img:Graphics[Raster[__],___]:> Flatten[img[[1,1]]];
gv=Chop[gv]

will do it with out a loop or other stupid things and should work with
Mathematica 6 and 7

Regards
   Jens

Valeria Volpe wrote:
> Hi,
> 
> another question just to finish my release....
> 
> This is the actual list I have:
> 
> 
> Quit[];
> SetDirectory["C:\\Users\\proprietario\\Desktop\\Desktop\\TESI\\Dati\\\Bitmap\\\Paziente
> 1"];
> nome = "p6.bmp";
> Import[nome, "ImageSize"];
> row = ToExpression[Import[nome, "ImageSize"]][[1]];
> col = ToExpression[Import[nome, "ImageSize"]][[2]];
> vmax = row*col;
> gv = Array[f, vmax];
> gl = Take[Import[nome, "GrayLevels"]];
> i= 0;
> Do[Do[ i=i + 1; gv[[i]] = gl[[j, k]], {k, 1, col}], {j, 1, row}];
> 
> 
> 
> It returns me an array which have these values...
> 
> 
> 0.
> 0.
> 0.
> 0.
> 0.
> 0.
> 0.
> 0.
> 0.1764705882352941
> 0.1764705882352941
> 0.1764705882352941
> 0.8941176470588235
> 0.
> 0.
> 0.
> 0.
> 
> 
> (this is just a part of the array)
> 
> Now I have to wite a "if" cycle which, when it reads "0." (in the array) it
> gives back just "0"  (without "." to be clear)
> 
> 
> i.e., i need a new array :
> 
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0
> 0.1764705882352941
> 0.1764705882352941
> 0.1764705882352941
> 0.8941176470588235
> 0
> 0
> 0
> 
> 
> Thanks a lot!!!
> 
> 
> Valeria
> 
> 


  • Prev by Date: Re: Basic questions on list manipulation in the "Mathematica Way"
  • Next by Date: Re: Problem with an integral
  • Previous by thread: Re: Basic questions on list manipulation in the "Mathematica Way"
  • Next by thread: Mathematica Animation Drives Me Crazy!