[Insight-developers] RE: Replication of Validation Study

Hans J. Johnson hans-johnson@uiowa.edu
02 Apr 2003 10:45:36 -0600


Lydia,

Thanks for all your help.

--Memory Resolution--
I don't honestly know.  I am working on the bleeding edge cvs checkouts,
and after I did a cvs update, the memory problem went away(as far as I
can tell, it seems to be using about 2.5GB memory, where it was seg
faulting at 3.5GB memory usage before (3GB+512MBswap).  The memory
explosion occured during the processing of the
ReinitializeLevelSetImageFilter<RealImageType>.  (This still causes
doubling of memory usage, but now seems to be under control.)


--Duplication of code---
My "new" application is algorithmically exactly like yours.  I am
attempting to make an application that can be used right out of the box
with any pair of Grayscale images (T1,T2,PD,CT) and any pair of binary
label images (brain mask, putamen masks, thalmus mask, etc...).  These
files can be any ITK suported file formats (Analyze75, MetaImage, PNG,
Dicom...)  I have also implemented the following changes:

1) parameter file no longer has data set information in it, but does
have key value pairs at the end for setting filenames of images to
extract at key locations along the registration processing pipeline.  I
have pretty much allowed you to write a separate image for the output of
each filter.
512
1
4
256 128 32 8
16 16 8
16 16 8
WRITE_DEFORMED_ATLAS_FILENAME          DeformedAtlas.img.gz
WRITE_DEFORMED_ATLAS_LABEL_FILENAME    DeformedAtlasLabel.img.gz
WRITE_DEFORMATION_FIELD_FILENAME_BASE  DeformationFeild.img.gz
COMPUTE_OVERLAP_METRIC        YES
COMPUTE_DISTANCE_METRIC       YES
TRANSFORM_WITH_LEVELSET       YES
    

2) All desired input images are specified on the commandline:
BrainStripValidationAppAtlasImage AtlasImage AtlasLabelImage
SubjectImage SubjectLabelImage OutputTextFile ParameterFile

Again thanks,
Hans

PS:  I have done some very preliminary test with warping the distance
map and the raw binary data, and I found that distance map method does
improve the overlap, but not by very much (representative overlap
increases from 0.886583 to 0.887421 for a putamen brain mask).  It may
not be worth the extra GB of memory required to run this analysis.

PPS: I have been working fast a furious to get this done, so my
conclusions should be taken with a grain of salt.  I am basing all
results on my best guesses of what I see, and not extensive probing.


On Tue, 2003-04-01 at 15:58, Lydia Ng wrote:
> Hans,
> 
> I am glad you got it to work for you. What did you end up doing in terms
> of the memory issue? I would interested to see what kind of results you
> are getting - just to get a feel of a broader range of applications.
> 
> About where do put things: seems like your code is an application of its
> own. So probably a separate directory in InsightApplications with its
> own readme etc seems the best.
> 
> We use to have free rein to add things in InsightApplications but I am
> not quite sure of the policy at the moments. There was an attempt to
> clean some things out. Perhaps send a note to the list that you want to
> add a generic version of the atlas-based segmentation application.
> 
> BTW - is there much overlap/duplication in your code to what's already
> there. I did try to factor out as much of the stuff directly related to
> IBSR and validation study as possible into classes? I guess you are the
> first person to test it out.
> 
> - Lydia
> 
> > -----Original Message-----
> > From: Hans Johnson [mailto:hjohnson@mail.psychiatry.uiowa.edu]
> > Sent: Tuesday, April 01, 2003 12:03 PM
> > To: Lydia Ng; insight-developers@public.kitware.com
> > Subject: Re: Replication of Validation Study
> > 
> > Lydia,
> > 
> > Thank you for your comments.  I have done some refactoring of your
> code
> > to break it's dependance on the IBSR data set.  I believe that this
> code
> > is much more useful to the general public, because it does not depend
> on
> >   the inputs having specific names and directory structures.  I would
> > like to contribute this to ITK, but I don't know where to put it, or
> how
> > to properly give credit to you for the work.
> > 
> > Do you have any suggestions?
> > 
> > Thanks,
> > Hans
> > 
> > Lydia Ng wrote:
> > > Hi Hans,
> > >
> > >
> >
> >>---------------------------------------------------------------------
> > >>1)  What does the ReinitializeLevelSetImageFilter<RealImageType> do?
> >
> >>(m_AtlasLabelImage-->Threasholder-->ReinitializeLevelSetImageFilter--
> > >>
> > >>>Warper)
> > >>
> > >
> > > Instead of warping the binary image directly, I warp a signed
> distance
> > > map of the distance away from the edges of the labeled structure.
> The
> > > method was recommended to me as you get a better more stable
> warping. A
> > > similar method is used in [6] for shape based interpolation.
> > >
> > >
> > >>2)  Do you have any suggestions on how to get around this problem?
> > >>
> > >
> > >
> > > How about breaking up the pipeline? For example, do an update after
> the
> > > reinitilaizer, keep a point to the signed distance image and clean
> up
> > > all upstream filters and intermediate images?
> > >
> > > You could also try if ProcessObject::ReleaseDataFlagOn() does what
> is
> > > suppose to? :-)
> > >
> > > Cheers,
> > > Lydia
> > >
> > >
> > >>-----Original Message-----
> > >>From: Hans Johnson [mailto:hjohnson@mail.psychiatry.uiowa.edu]
> > >>Sent: Monday, March 31, 2003 9:29 AM
> > >>To: Lydia Ng
> > >>Subject: Replication of Validation Study
> > >>
> > >>Lydia,
> > >>
> > >>I am attempting to run a test parallel to your excellent "Validation
> > >>Study: Atlas-based Brain Volume Segmentation from MRI Images".  I
> have
> > >>refactored your BrainStripValidationApp to read from read from
> > >
> > > arbitrary
> > >
> > >>   locations, and everything must be explicitly defined on the
> command
> > >>line, but I have made no algorithmic changes.
> > >>
> > >>The data that I am attempting to match are T1 weighted images that
> > >
> > > have
> > >
> > >>approximately the same characteristics as your dataset, but they are
> > >>320x320x384 voxel volumes.
> > >>
> > >>The problem that I have is that my data sets are quite large, and I
> > >
> > > run
> > >
> > >>out of memory (3GB+512 swap ~ 3.5GB) during the Atlas labeler stage.
> > >
> > > In
> > >
> > >>particular, the memory explodes during this filter:
> > >>
> > >>typedef ReinitializeLevelSetImageFilter<RealImageType> DistanceType;
> > >>typename DistanceType::Pointer distance = DistanceType::New();
> > >>
> > >>distance->SetInput( inputThresholder->GetOutput() );
> > >>distance->NarrowBandingOn();
> > >>distance->Update();
> > >>std::cout << "   ---Atlas Distancemapper Done" << std::endl;
> > >>
> > >>
> > >>Approximate memory usage:
> > >>start: 0MB
> > >>registration: ~800MB-1000MB
> > >>atlas label:  > 3000MB
> > >>
> >
> >>---------------------------------------------------------------------
> > >>1)  What does the ReinitializeLevelSetImageFilter<RealImageType> do?
> >
> >>(m_AtlasLabelImage-->Threasholder-->ReinitializeLevelSetImageFilter--
> > >>
> > >>>Warper)
> > >>
> > >>2)  Do you have any suggestions on how to get around this problem?
> > >>
> >
> >>----------------------------------------------------------------------
> > >>Any help would be greatly appreciated.
> > >>
> > >>Hans
> > >>--
> > >>===================================================================
> > >>Hans J. Johnson                              W294 GH
> > >>hans-johnson@uiowa.edu                       Dept. of Psychiatry
> > >>http://www.psychiatry.uiowa.edu/~hjohnson    The University of Iowa
> > >>(319) 353-8587                               Iowa City, IA 52242
> > >>===================================================================
> > >>
> > >
> > 
> > 
> > --
> > ===================================================================
> > Hans J. Johnson                              W294 GH
> > hans-johnson@uiowa.edu                       Dept. of Psychiatry
> > http://www.psychiatry.uiowa.edu/~hjohnson    The University of Iowa
> > (319) 353-8587                               Iowa City, IA 52242
> > ===================================================================