<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'><br>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">Hello: I'm trying to make a co-registration plug-in for osirix, i have already test the wrapimagefloat3d to export 1 image, defining the viewer controller as <br>ViewerController *new2DViewer;<br> new2DViewer = [self duplicateCurrent2DViewerWindow];<br><br>but now I try to pass two images as if is was a fusion filter but it doesn't work... here is the part of the code i use to import the images between osirix and ITK<br>The code is build in Xcode without any error. I think my error is in the declaration of DCMview but i cant fixed.</div><div dir="ltr">Any help would be great</div><div dir="ltr">Thanks!!</div><div dir="ltr">Carlos Caldart<br><br>- (ImageTypeFloat3D::Pointer)WrapImageFloat3D:(ViewerController*)Viewer<br><br>{<br>        ImageTypeFloat3D::Pointer image;<br>        ImportFilterTypeFloat3D::Pointer importFilter = ImportFilterTypeFloat3D::New();<br>        ImportFilterTypeFloat3D::SizeType size;<br>        ImportFilterTypeFloat3D::IndexType start;<br>        ImportFilterTypeFloat3D::RegionType region;<br><br><br>        DCMPix *firstPix = [[Viewer pixList] objectAtIndex:0];<br>        int slices = [[Viewer pixList] count];<br><br><br>//        Size Width * Height * NoOfSlices<br>        size[0] = [firstPix pwidth];<br>        size[1] = [firstPix pheight];<br>        size[2] = slices;<br><br><br>        long bufferSize = size[0] * size[1] * size[2];<br><br><br>        start.Fill(0);<br><br><br>        region.SetIndex(start);<br>        region.SetSize(size);<br><br><br>        double voxelSpacing[3];<br>        double originConverted[3];<br>        double vectorOriginal[9];<br>        double origin[3];<br><br><br>        origin[0] = [firstPix originX];<br>        origin[1] = [firstPix originY];<br>        origin[2] = [firstPix originZ];<br><br><br>        [firstPix orientationDouble: vectorOriginal];<br>        originConverted[ 0] = origin[ 0] * vectorOriginal[ 0] + origin[ 1] * vectorOriginal[ 1] + origin[ 2] * vectorOriginal[ 2];<br>        originConverted[ 1] = origin[ 0] * vectorOriginal[ 3] + origin[ 1] * vectorOriginal[ 4] + origin[ 2] * vectorOriginal[ 5];<br>        originConverted[ 2] = origin[ 0] * vectorOriginal[ 6] + origin[ 1] * vectorOriginal[ 7] + origin[ 2] * vectorOriginal[ 8];<br><br><br>        voxelSpacing[0] = [firstPix pixelSpacingX];<br>        voxelSpacing[1] = [firstPix pixelSpacingY];<br>        voxelSpacing[2] = [firstPix sliceInterval];<br><br><br>        importFilter->SetRegion(region);<br>        importFilter->SetOrigin(originConverted);<br>        importFilter->SetSpacing(voxelSpacing);<br>        importFilter->SetImportPointer(Viewer* , bufferSize, false); //do not overwrite original data<br><br><br>                image = importFilter->GetOutput();<br>        image->Update();<br><br><br>        return image;<br><br><br>}<br><br>- (void)UnwrapImageFloat3D:(ImageTypeFloat3D::Pointer)img Viewer:(ViewerController*)Viewer<br>{<br><br><br>        ImageTypeFloat3D::SizeType size = img->GetLargestPossibleRegion().GetSize();<br><br><br>        long bufferSize = size[0] * size[1] * size[2];<br>        long mem = bufferSize * sizeof(float);<br>        memcpy( [Viewer volumePtr], img->GetBufferPointer(), mem);<br><br><br>}<br><br>- (long) filterImage:(NSString*) menuName<br>{<br><br>        DCMView *viewB = [ViewerController imageView];<br>        // [[viewerController window] setTitle: @" :: Fixed Image"];<br><br>        DCMView *viewA = [[ViewerController blendedWindow] imageView];<br>        // [[[viewerController blendedWindow] window] setTitle: @" :: Moving Image"];<br><br>        typedef ITKNS::Image< PixelTypeFloat, 3 > FixedImageType;<br>        typedef ITKNS::Image< PixelTypeFloat, 3 > MovingImageType;<br><br><br>        const unsigned int ImageDimension = 3;<br>        <br><br>        //<br>        // Read the Fixed and Moving images.<br>        //<br><br><br>        FixedImageType::Pointer fixedImage = [self WrapImageFloat3D:viewB];<br>        MovingImageType::Pointer movingImage = [self WrapImageFloat3D:viewA];<br><br><br>        registration->SetFixedImage( fixedImage );<br>        registration->SetMovingImage( movingImage );<br> <br>//Registration code no included<br><br>        [self UnwrapImageFloat3D:resample->GetOutput() Viewer:viewA];<br><br><br> <br></div>
                                           </div></body>
</html>