Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4494 > unrolled thread

Re: Memory when reding in data

Started by"Scot T. Martin" <smartin@seas.harvard.edu>
First post2011-08-20 10:24 +0000
Last post2011-08-20 10:24 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Memory when reding in data "Scot T. Martin" <smartin@seas.harvard.edu> - 2011-08-20 10:24 +0000

#4494 — Re: Memory when reding in data

From"Scot T. Martin" <smartin@seas.harvard.edu>
Date2011-08-20 10:24 +0000
SubjectRe: Memory when reding in data
Message-ID<j2o20j$4vs$1@smc.vnet.net>
When you don't need Mathematica to remember anything for In[..] and Out[..] functionality, set $HistoryLength, e.g., default value is Infinity. If you really don't need the In/Out functionality, use $HistoryLength = 1.
________________________________________
From: Peter Rodenbach [peter.rodenbach@googlemail.com]
Sent: Friday, August 19, 2011 06:34
Subject: Memory when reding in data

Hi everyone.

I am analysing image data and I have the problem that after about 50
images or so Mathematica quits the calculation with the hint out of
memory. The interesting part of the code i wrote is :

(*Import the first image into Maxvals, which will be compared to all \
other images and overwritten if any point is found to be larger*)

SetDirectory[
  "E:\\...];

Initialise = OpenRead["s2_260_0000.edf", BinaryFormat -> True];
MaxValues =
  BinaryRead["s2_260_0000.edf",
   Table["UnsignedInteger16", {512}, {512}]];
counter = Dimensions[MaxValues];

(*Load all experimental images and perform maximum projection*)

MaxProjection[filename_] := {OpenRead[filename, BinaryFormat -> True],
   Imagevalues =
   BinaryRead[filename, Table["UnsignedInteger16", {512}, {512}]],
  For[i = 1, i <= counter[[1]], i++,
        For [j = 1, j <= counter[[2]], j++,
    If[MaxValues[[i, j]] >= Imagevalues[[i, j]],
     MaxValues[[i, j]] = MaxValues[[i, j]],
     MaxValues[[i, j]] = Imagevalues[[i, j]]]
        ]
   ], Close[Imagevalues]}


MaxProjection[#] & /@ FileNames@"*edf"

So I guess Mathm saves all the data of all the images after each
other. But once the comparision is done with the one MaxProjection
Image I want to have, all the data can be dumped from the memory and
then the next image can be compared with this MaxProjection image.

Does anyone have an idea? Thx.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web