Thursday, May 17, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: JBauza
New Today New Today: 19
New Yesterday New Yesterday: 33
User Count Overall: 22559

People Online People Online:
Visitors Visitors: 9
Members Members: 1
Total Total: 10

Online Now Online Now:
01: dougsrl

ClearCanvas Community Forums

Filter reset
Last Post 2009-05-15 08:58 AM by stewart. 7 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
netultra
Basic Member
Basic Member
Posts:30

--
2008-06-16 05:41 PM  
Hi,

What would be the best way to reset an image to its origanal presentation after a filter operation is applied?

Thanks!
norman
Senior Member
Senior Member
Posts:813

--
2008-06-17 05:55 PM  
Hi,

I assume the problem you have is this:

1) You've applied a filter to the image, and have thus changed the pixel data
2) You want to restore the original pixel data

We recently added an UnloadPixelData() method to the Frame class that might help you with this. When you want the original pixel data back, just call Frame.UnloadPixelData(). I think that should be all you need to do. Once you've called it, just get the pixel data the way you would normally--it'll automatically go to the disk and fetch it again. Let me know if this works.

N.
netultra
Basic Member
Basic Member
Posts:30

--
2008-06-19 07:03 PM  
Hi,

I did the below and the selected image is reloaded.

this.SelectedImageSopProvider.Frame.UnloadPixelData();
this.SelectedImageSopProvider.Frame.GetNormalizedPixelData();

How could I reload the entirer stack? I foud ImageViewer.LoadImages or LoadStudy.
But, I could not get the information to supply to either one.

Thanks!

stewart
Senior Member
Senior Member
Posts:2128

--
2008-06-19 07:20 PM  
Hi, what you will need to do is iterate through the display set and call UnloadPixelData for each image.  Something like this would work:

if (base.SelectedPresentationImage != null)
{
    foreach (IPresentationImage image in base.SelectedPresentationImage.ParentDisplaySet.PresentationImages)
    {
        if (image is IImageSopProvider)
            ((IImageSopProvider) image).Frame.UnloadPixelData();
    }
}

Real-time support available to Clinical Edition and Team Edition customers
netultra
Basic Member
Basic Member
Posts:30

--
2009-03-11 05:14 PM  
Hi Stewart,

ClearCanvas.ImageViewer.StudyManagement.Frame.UnloadPixelData() is no longer working as before. It calls StandardSopDataSource.UnloadFrameData(int) which does nothing. Is this a bug? If not, what is an equivalent method for reloading original pixel data?

Thanks!
stewart
Senior Member
Senior Member
Posts:2128

--
2009-03-11 07:11 PM  

Hi netultra, it was kind of a conscious decision :)  Basically, instead of Sops being shared between viewers, it is now these Sop data sources that are shared and each viewer has it's own Sops that reference the shared data source.  When the pixel data is 'unloaded' on a Sop, it's really only it's own reference that gets cleared.  The data source maintains a weak reference cache of pixel data so that when all the sops referencing it have cleared their pixel data, only then will the memory actually be freed by the garbage collector.  It's an optimization.

I admit I forgot about the case where someone might apply a filter in place.  Ideally, filtering would be a presentation level thing, where filters can be added to an image dynamically and when the image is drawn, the filters are applied and the output is rendered.  This way, the original pixel data would be preserved.

Applying filters in-place can be problematic because the filtering effects will be present everywhere that image is drawn.  However, since we don't actually have framework support for adding filters to images, I'll change it back to the way it was.  I've entered a ticket here.

Thanks for pointing it out,
Stewart

Real-time support available to Clinical Edition and Team Edition customers
netultra
Basic Member
Basic Member
Posts:30

--
2009-03-12 12:13 PM  
Hi Stewart,
I agree with your statements above. Having filtering at presentation level is the way to go. :-)
Thank you very much for helping us out for the time being!
stewart
Senior Member
Senior Member
Posts:2128

--
2009-05-15 08:58 AM  
Just to follow up on this issue, there have been a number of checkins related to this in the last few days and the problem has now been fixed.

Best regards,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2012 ClearCanvas Inc.