Thursday, February 09, 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: VMCCNY
New Today New Today: 18
New Yesterday New Yesterday: 26
User Count Overall: 20581

People Online People Online:
Visitors Visitors: 18
Members Members: 5
Total Total: 23

Online Now Online Now:
01: ednfran
02: sfrank
03: rmk
04: munir24hr
05: demidias

ClearCanvas Community Forums

Scale ISptialTransformProvider
Last Post 2010-12-08 12:16 AM by hanif123. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
alagarajaR
Basic Member
Basic Member
Posts:16

--
2010-01-05 07:45 PM  

Hi All,

I am trying to write a basic DICOM VIewer with Zoom, Pan, WIndow Level / Window Width using ClearCanvas. Managed to write Load Images , and apply PAN and Window Level/ Window Width. But when I try to implement zoom , it does work for me. The Scale value does not change irrespective of values been set. Have attached the code snippet

LocalSopDataSource  _sop = new LocalSopDataSource("C:\\DcmFile\\001.dcm");

ImageSop imageSop = new ImageSop(_sop);

IEnumerable images =   PresentationImageFactory.Create(imageSop);

 foreach (IPresentationImage image in images)

           {
               ISpatialTransformProvider spatial = image as ISpatialTransformProvider;
               spatial.SpatialTransform.Scale = 3;
               bitmap = image.DrawToBitmap(256, 256);
           }
 
 Am I doing any wrong here. I also tried to get image as ImageSpatialTransform but it returned null for me.
 
           ImageSpatialTransform spatial = image as ImageSpatialTransform;
 
It would be great if someone can help me out.
 
Thanks and Regards
R.Alagaraja

stewart
Senior Member
Senior Member
Posts:2032

--
2010-01-12 09:40 AM  
Hi, try this:

ISpatialTransformProvider provider = image as ISpatialTransformProvider;
ImageSpatialTransform transform = (ImageSpatialTransform)provider.SpatialTransform;
transform.ScaleToFit = false;
transform.Scale = 3;

Hope this helps,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
alagarajaR
Basic Member
Basic Member
Posts:16

--
2010-02-08 10:59 AM  

Hi Stewart,

Sorry for delay in reply. Thanks for your reply . It worked fine.

To display this out to a screen ( I prefered writing it to a PictureBox) I did go for DrawToBitmap function of Presentation Image. But it seems to slow when compared to Draw that you have writtern. The delay depends on height of the PictureBox (Have assigned the bitmap to the pictureBox and have fit it). Is there any way that i can get bitmap from IPresentationImage which would be faster than the DrawBitmap ?

 

Thanks

R.Alagaraja

 

stewart
Senior Member
Senior Member
Posts:2032

--
2010-02-15 11:09 PM  
Hi, the PictureBox approach is going to be slower because you've already done a double-buffered draw to a bitmap, and then another draw to the screen via the PictureBox. You could try fiddling with some of the PictureBox properties (turn off double-buffering, etc). Also, if the PictureBox has to do any fitting of the image, that will take time, so you'll need to ensure your PictureBox is the same size as the Bitmap.

If you want it to go faster, you will need to use the IPresentationImage's renderer to draw directly to a window/control. It's really not that bad to do, and you can probably just take the code from the TileControl class in the viewer.

Hope this helps,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
alagarajaR
Basic Member
Basic Member
Posts:16

--
2010-02-19 12:42 AM  

Thanks a ton Stewart.

Will Check from my end and let u know . 

hanif123
New Member
New Member
Posts:4

--
2010-12-08 12:16 AM  
Hi Alagaraja...

Iam also face the same issue when zooming. Did u finish the same?

I want to draw a rectangle while zooming in picturebox. the mousepoint is different with loaded image and picturebox. So, the rectangle is draw somewhere in the image.

Suggest me to how can i sort out this issues and post the sample code.
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2011 ClearCanvas Inc.