[Insight-users] Problem with Saving a segmented object

Cameron Burnett w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
Tue Apr 8 11:10:03 EDT 2008


Luis,

Thanks for the reply.

I've been reading in the file as a float type because the curvature flow algorithm was whinging about wanting either a float or double type. Originally I had it as signed short. After the smoothing filter I'm casting it from float to signed short, just because thats the type it was originally. I'm also not sure what type my output vtk file should be. So how much memory would my casting filter take up?

smoothing->SetInput( reader->GetOutput() );    //input a float, output a float
outputCaster->SetInput(smoothing->GetOutput());        //input float, output signed short
confidenceConnected->SetInput( outputCaster->GetOutput() );    //signed short
writer->SetInput( confidenceConnected->GetOutput() );    //signed short

I'm using Windows Vista, so there's a big problem already. When i'm not doing anything it sometimes takes up 400MB but could also go up to 700 (most common) or even 1GB. Such variations I find quite strange but oh well.... at least it hasnt crashed on me yet. When I load the DICOM file into my VTK MFC program (using ray casting) the program jumps from about 8MB ram usage to 360MB... so if you combine that with the other segmentation stuff it doesn't really leave much. I also realised I had another casting filter initialised that I hadn't used in the pipeline, so there's a few more hundred to add to the list.

Also, 1 more question. The algorithm sort of works for small data sets, but the output vtk file is split into solid red and blue parts like in this picture. I'm just wondering if that is a mask of some sort, or is it that I'm just doing something wrong. The DicomSeriesReadImageWrite2 example didn't mention anything about masks, so I'm not sure what is going on. I was trying to put the seed in where the point widget is pointing to in the background.
http://img371.imageshack.us/img371/6677/dicomtovtk1ju8.jpg


Thanks,

Cameron.





> Date: Sun, 6 Apr 2008 19:43:44 -0400
> From: luis.ibanez at kitware.com
> To: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
> CC: insight-users at itk.org
> Subject: Re: [Insight-users] Problem with Saving a segmented object
> 
> 
> Hi Cameron,
> 
> Thanks for the additional information.
> 
> Here is the memory break down that we can anticipate
> from your image size and filters:
> 
> Image CT: pixel type signed short: 2 bytes / pixel
> Slice size: 512 x 512
> Number of slices: Unknown (you don't mention it in your email)  :-/
>     but... working it backwards from the 170Mb of your last email,
>     we can presume that the number of slices is:  340 slices.
> 
> 
> The filters in memory will take the following:
> 
> 
> 1) Reader          =   170 Mb
> 2) Curvature Flow  =   170 Mb (or 340Mb if you use float)
> 3) Confidence Conn.=    85 Mb (char pixel type)
> 4) CastImage filter=    ?? Mb (not sure what pixel type you used)
>                         ------
>                         425 MB
> 
> 
> You don't really need the caster after the smoother.
> You could simply run confidence connected in the
> output of the reader.
> 
> This still doesn't accounts for 2GigaBytes...
> 
> What is your operating system?
> 
> Could you double check the progressive allocation
> of memory in the Task Manager (if Windows) or with
> top (or KSysGuard) (if Linux).
> 
> 
>     Please let us know what you find.
> 
> 
>        Thanks
> 
> 
>           Luis
> 
> 
> ------------------
> Cameron Burnett wrote:
> > Hi Luis,
> > 
> > Thanks for the input.
> > 
> > I don't have any extra filters apart from the standard ones from the 
> > Confidence Connected example. CurvatureFlowImageFilter, 
> > ConfidenceConnectedImageFilter, and a CastImageFilter. I played around 
> > with the casting a little bit but it didn't seem to effect it (casting 
> > before and after the confidence connected filter). Maybe it does have 
> > something to do with that though?? I don't know.
> > 
> >   smoothing->SetInput( reader->GetOutput() );
> >   outputCaster->SetInput(smoothing->GetOutput());    //had this line 3rd 
> > previously
> >   confidenceConnected->SetInput( outputCaster->GetOutput() );
> >   writer->SetInput( confidenceConnected->GetOutput() );
> > 
> > 
> > The type of DICOM file is CT (i presume that's what you meant by 
> > modality). The number of pixels, well I'm guessing that it's [7fe0|0000 
> > = 524296] but that's just a wild stab in the dark. I'm presuming you 
> > would know exactly what to look for in the header so i've included it. 
> > This is the header for the first slice which I managed to extract 
> > through ITK-Snap...
> > 
> > 0002|0000 = 190
> > 0002|0001 = AAE=
> > 0002|0002 = 1.2.840.10008.5.1.4.1.1.2
> > 0002|0003 = 1.2.392.200036.9116.2.2.2.1762576288.1175672259.918312
> > 0002|0010 = 1.2.840.10008.1.2
> > 0002|0012 = 1.2.840.10008.5.1.4.1.1.7.0.1.0
> > 0002|0013 = C-PACS
> > 0008|0000 = 358
> > 0008|0008 = ORIGINAL\PRIMARY\AXIAL
> > 0008|0016 = 1.2.840.10008.5.1.4.1.1.2
> > 0008|0018 = 1.2.392.200036.9116.2.2.2.1762576288.1175672259.918312
> > 0008|0020 = 20070404
> > 0008|0022 = 20070404
> > 0008|0023 = 20070404
> > 0008|0030 = 163042.000
> > 0008|0032 = 163307.450
> > 0008|0033 = 163309.450
> > 0008|0060 = CT
> > 0008|0070 = TOSHIBA
> > 0008|0080 = Radiol. UK S-H Campus Luebeck
> > 0008|1010 = 0001
> > 0008|1040 = ID_DEPARTMENT
> > 0008|1090 = Aquilion
> > 0010|0000 = 46
> > 0010|0010 = HUEFTE^^^^
> > 0010|0020 = 555
> > 0018|0000 = 212
> > 0018|0010 = CE
> > 0018|0022 = HELICAL_CT
> > 0018|0050 = 1.0
> > 0018|0060 = 120
> > 0018|0090 = 240.00
> > 0018|1000 = B0622156
> > 0018|1020 = V2.05ER001
> > 0018|1100 = 240.00
> > 0018|1120 = +0.0
> > 0018|1130 = +132.00
> > 0018|1140 = CW
> > 0018|1150 = 1000
> > 0018|1151 = 230
> > 0018|1152 = 230
> > 0018|1210 = FC30
> > 0018|5100 = HFS
> > 0020|0000 = 370
> > 0020|000d = 1.2.392.200036.9116.2.2.2.1762576288.1175671825.193444
> > 0020|000e = 1.2.392.200036.9116.2.2.2.1762576288.1175672259.904331
> > 0020|0010 = 3282
> > 0020|0011 = 3
> > 0020|0012 = 3
> > 0020|0013 = 1
> > 0020|0020 = L\P
> > 0020|0032 = -120.000000\-120.000000\-1198.500000
> > 0020|0037 = 1.000000\0.000000\0.000000\0.000000\1.000000\0.000000
> > 0020|0052 = 1.2.392.200036.9116.2.2.2.1762576288.1175671854.644030
> > 0020|1041 = -168.00
> > 0028|0000 = 154
> > 0028|0002 = 1
> > 0028|0004 = MONOCHROME2
> > 0028|0010 = 512
> > 0028|0011 = 512
> > 0028|0030 = 0.468\0.468
> > 0028|0100 = 16
> > 0028|0101 = 16
> > 0028|0102 = 15
> > 0028|0103 = 1
> > 0028|1050 = 300
> > 0028|1051 = 1600
> > 0028|1052 = 0
> > 0028|1053 = 1
> > 0040|0000 = 116
> > 0040|0002 = 20070404
> > 0040|0003 = 163042.000
> > 0040|0004 = 20070404
> > 0040|0005 = 170042.000
> > 0040|0244 = 20070404
> > 0040|0245 = 163042.000
> > 0040|0253 = 15553
> > 7fe0|0000 = 524296
> > 
> > 
> > 
> > 
> > Thanks heaps for your help, its greatly appreciated,
> > 
> > Cameron.
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> >  > Date: Sun, 6 Apr 2008 17:23:56 -0400
> >  > From: luis.ibanez at kitware.com
> >  > To: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
> >  > CC: insight-users at itk.org
> >  > Subject: Re: [Insight-users] Problem with Saving a segmented object
> >  >
> >  >
> >  > Hi Cameron,
> >  >
> >  > It shouldn't be a problem to handle a 170Mb image, either for
> >  > reading, writing, and running a region growing segmentation.
> >  >
> >  > ...You may have additional filters in the pipeline....
> >  >
> >  > Could you please describe the full pipeline ?
> >  >
> >  > and also provide the information of your image:
> >  >
> >  > a) number of pixels
> >  > b) Image Modality / pixel type
> >  >
> >  >
> >  > Thanks
> >  >
> >  >
> >  > Luis
> >  >
> >  >
> >  > -------------------------
> >  > Cameron Burnett wrote:
> >  > >
> >  > > I just tried a smaller DICOM data set, and it worked (well not the 
> > way I
> >  > > want it to, but it generated a vtk file). Is a 170MB DICOM data set
> >  > > normally too big to handle with region growing? Is it possible to
> >  > > perhaps buffer some to the file, clear the memory, then do the rest of
> >  > > it?? I'm not at all sure what I should do. I'd consider doing it slice
> >  > > by slice, but I read somewhere that all the 2D algorithms can be used
> >  > > for 3D as well.
> >  > >
> >  > >
> >  > >
> >  > > This is the output i'm getting. I was actually pleased that it did
> >  > > SOMETHING, but its obviously not what I want from my segmentation....
> >  > >
> >  > > http://img371.imageshack.us/img371/6677/dicomtovtk1ju8.jpg
> >  > >
> >  > > You can see the dicom object and the vtkPointWidget in the background.
> >  > > I'm using the point widget for the seed point, but for some reason it
> >  > > wants to colour all the way to the boundary of the widget. *shrug*. 
> > I'll
> >  > > just play around with the variables a bit I guess, unless anyone can
> >  > > recommend that I try anything else.
> >  > >
> >  > > Thanks.
> >  > >
> >  > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > From: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
> >  > > To: insight-users at itk.org
> >  > > Date: Fri, 4 Apr 2008 01:11:15 +1000
> >  > > Subject: [Insight-users] Problem with Saving a segmented object
> >  > >
> >  > > Hi,
> >  > >
> >  > > I've just implemented a mix of the DicomSeriesReadImageWrite2 and
> >  > > ConfidenceConnected algorithm examples for region growing
> >  > > segmentation. So basically, I want to segment a DICOM file and then
> >  > > save it as vtk or a similar file format (Unless there is a better
> >  > > way that anyone knows of).
> >  > >
> >  > > The problem is that once I run the segmentation it takes 10 minutes
> >  > > in order to spit an error message back.
> >  > >
> >  > > So what is it doing? Well, my program gets through to the execution
> >  > > of the writer pipeline quite quickly (writer->Update() ). After that
> >  > > the cpu is maxed out at 100% and my RAM is practically maxed out
> >  > > also (I have 2GB, and 360MB is taken up once I load my DICOM file
> >  > > onto the screen via the raycast method). Then after about 10 minutes
> >  > > I get an error in itkProcessObject.cxx. This is in the
> >  > > ProcessObject::UpdateOutputData function, where it calls
> >  > > this->GenerateData(). When I mouse-over the exception in vc++ it
> >  > > says something about failing to allocate memory for the file.
> >  > >
> >  > > I originally thought it had something to do with pixel type casting,
> >  > > because the pre-segmentation smoothing requires a float pixel type
> >  > > and I had just left it as float for the rest also. Then I tried
> >  > > casting it back to "signed short" before the segmentation stage....
> >  > > but that did the same. 10 minutes is a long time to wait to see if a
> >  > > small change works.
> >  > >
> >  > > So the main question is.... should it take 10 minutes for a 2GHz
> >  > > dual core cpu (with 2GB ram) to do region growing segmentation (then
> >  > > die, lol). Btw, the DICOM files are about 170MB for the whole 342 of
> >  > > them (about 500KB each file).
> >  > >
> >  > > Also, if anyone knows whats going on, or would like to request more
> >  > > information, then that would be great. I'm not expecting much though.
> >  > >
> >  > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > Find out: SEEK Salary Centre Are you paid what you're worth?
> >  > > 
> > <http://a.ninemsn.com.au/b.aspx?URL=http://ninemsn.seek.com.au/career-resources/salary-centre/?tracking%3Dsk:het:sc:nine:0:hot:text&_t=764565661&_r=OCT07_endtext_salary&_m=EXT>
> >  > >
> >  > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > > Grab it. You dream job is up for grabs.
> >  > > <http://mycareer.com.au/?s_cid=596065 >
> >  > >
> >  > >
> >  > > 
> > ------------------------------------------------------------------------
> >  > >
> >  > > _______________________________________________
> >  > > Insight-users mailing list
> >  > > Insight-users at itk.org
> >  > > http://www.itk.org/mailman/listinfo/insight-users
> > 
> > ------------------------------------------------------------------------
> > Grab it. You dream job is up for grabs. 
> > <http://mycareer.com.au/?s_cid=596065 >

_________________________________________________________________
Search for local singles online @ Lavalife - Click here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30290&_t=764581033&_r=email_taglines_Search_OCT07&_m=EXT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080409/a15a281f/attachment-0001.htm>


More information about the Insight-users mailing list