<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="MSHTML 5.00.2919.6307" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2> I am trying to register two 3D data
sets dataset1 and dataset2. After registering I </FONT></DIV>
<DIV><FONT face=Arial size=2> 1) transform
dataset2 using vtkImageReslice</FONT></DIV>
<DIV><FONT face=Arial size=2> 2) blend the
images using vtkImageBlend</FONT></DIV>
<DIV><FONT face=Arial size=2> 3) display the
data using imageViewer.</FONT></DIV>
<DIV><FONT face=Arial size=2> 4) display the
3D data of the blended image.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> Now after scaling the size of dataset1
and transformed dataset2 is not same. Hence when I blend the images, the images
donot overlap. Instead the dataset2 starts from the lower left corner in the
window. Using vtkReslice I tried to tried to bring the images in place,
but this time I get the original image instead of the transformed
one.Further a 3D view of the images is much worse. Can somebody please help me
out. The pipeline is as follows :</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2>
<P>void Reader::display() {</P>
<P>vtkTransform *transO1 = vtkTransform::New();</P>
<P>transO1->Translate(15,-5,0);</P>
<P>vtkTransform *transO2 = vtkTransform::New();</P>
<P>transO2->Translate(width/2,height/2,0);</P>
<P>vtkTransform *trans1 = vtkTransform::New();</P>
<P>trans1->Scale(0.9,0.9,1);</P>
<P>trans1->Translate(0,10,2); </P>
<P>vtkTransform *trans = vtkTransform::New();</P>
<P>trans->Concatenate(transform);</P>
<P></P>
<P>vtkVolume16Reader *reader1 = vtkVolume16Reader::New();</P>
<P>reader1->SetFilePrefix(fileName1[0]);</P>
<P>reader1->SetHeaderSize(header[0]);</P>
<P>if (byteSwap) </P>
<P>reader1->SwapBytesOn();</P>
<P>reader1->SetImageRange(range[0][0],range[0][1]);</P>
<P>reader1->SetDataSpacing(space[0][0], space[0][1], space[0][2]);</P>
<P>reader1->SetDataDimensions(height, width);</P>
<P>vtkImageReslice *reslice1 = vtkImageReslice::New();</P>
<P>reslice1->SetInput(reader1->GetOutput());</P>
<P>reslice1->InterpolateOn();</P>
<P>reslice1->SetInterpolationModeToCubic();</P>
<P>reslice1->OutputAlwaysCenteredOnInputOn() ;</P>
<P>vtkImageViewer *viewer1 = vtkImageViewer::New();</P>
<P>viewer1->SetInput(reslice1->GetOutput());</P>
<P>viewer1->SetColorLevel(1000);</P>
<P>viewer1->SetZSlice(0);</P>
<P>viewer1->Render();</P>
<P>reader1->Delete();</P>
<P>char a;</P>
<P>cin>>a;</P>
<P>vtkVolume16Reader *reader2 = vtkVolume16Reader::New();</P>
<P>reader2->SetFilePrefix(fileName1[1]);</P>
<P>reader2->SetHeaderSize(header[1]);</P>
<P>if (byteSwap) </P>
<P>reader2->SwapBytesOn();</P>
<P>reader2->SetImageRange(range[1][0],range[1][1]);</P>
<P>reader2->SetDataSpacing(space[1][0], space[1][1], space[1][2]);</P>
<P></P>
<P>reader2->SetDataDimensions(height, width);</P>
<P></P>
<P>reslice->SetInput(reader2->GetOutput());</P>
<P>reader2->Delete();</P>
<P>reslice->SetOutputSpacing(1,1,1);</P>
<P>reslice->InterpolateOn();</P>
<P>reslice->SetInterpolationModeToCubic();</P>
<P>reslice->OutputAlwaysCenteredOnInputOn() ;</P>
<P>reslice->SetResliceTransform(trans);</P>
<P></P>
<P>vtkImageTranslateExtent *extTrans = vtkImageTranslateExtent::New();</P>
<P>extTrans->SetInput(reslice->GetOutput());</P>
<P>extTrans->SetTranslation(width*0.0,height*0.0,0);</P>
<P></P>
<P>vtkImageReslice *reslice2 = vtkImageReslice::New();</P>
<P>reslice2->SetInput(extTrans->GetOutput());</P>
<P>vtkImageViewer *viewer2 = vtkImageViewer::New();</P>
<P>viewer2->SetInput(reslice->GetOutput());</P>
<P>viewer2->SetColorLevel(1000);</P>
<P>viewer2->SetZSlice(0);</P>
<P>viewer2->Render();</P>
<P>cin>>a;</P>
<P>vtkImageBlend *blend = vtkImageBlend::New();</P>
<P>blend->SetInput(0,reslice1->GetOutput());</P>
<P>blend->SetInput(1,reslice->GetOutput());</P>
<P>blend->SetOpacity(1,0.5);</P>
<P>vtkImageViewer *viewerB = vtkImageViewer::New();</P>
<P>viewerB->SetInput(blend->GetOutput());</P>
<P>viewerB->SetColorWindow(255.0);</P>
<P>viewerB->SetColorLevel(127.5);</P>
<P>viewerB->Render();</P>
<P>cin>>a;</P>
<P>vtkRenderWindow *win = vtkRenderWindow::New();</P>
<P>vtkRenderer *ren = vtkRenderer::New();</P>
<P>win->AddRenderer(ren);</P>
<P>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</P>
<P>iren->SetRenderWindow(win);</P>
<P>vtkImageToStructuredPoints *iToStruct =
vtkImageToStructuredPoints::New();</P>
<P>iToStruct->SetInput(blend->GetOutput());</P>
<P>vtkMarchingCubes *march = vtkMarchingCubes::New();</P>
<P>march->SetInput(iToStruct->GetOutput());</P>
<P>march->ComputeScalarsOff();</P>
<P>march->ComputeGradientsOff();</P>
<P>march->ComputeNormalsOff();</P>
<P>march->SetValue(0,150);</P>
<P></P>
<P>vtkSmoothPolyDataFilter *smoother = vtkSmoothPolyDataFilter::New();</P>
<P>smoother->SetInput(march->GetOutput());</P>
<P>smoother->SetNumberOfIterations(6);</P>
<P>smoother->SetRelaxationFactor(0.1);</P>
<P>smoother->SetFeatureAngle(10);</P>
<P>smoother->FeatureEdgeSmoothingOff();</P>
<P>smoother->BoundarySmoothingOff();</P>
<P>smoother->SetConvergence(0);</P>
<P>vtkPolyDataNormals *normals = vtkPolyDataNormals::New();</P>
<P>normals->SetInput(smoother->GetOutput());</P>
<P>normals->SetFeatureAngle(10);</P>
<P>vtkStripper *stripper = vtkStripper::New();</P>
<P>stripper->SetInput(normals->GetOutput());</P>
<P>vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();</P>
<P>mapper->SetInput(stripper->GetOutput());</P>
<P>vtkActor *actor = vtkActor::New();</P>
<P>actor->SetMapper(mapper);</P>
<P>ren->AddActor(actor);</P>
<P>win->Render();</P>
<P>iren->Start();</P>
<P>}</P></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>AMIT</FONT> </DIV>
<DIV><FONT size=2>
<P> </P></FONT></DIV></BODY></HTML>