<div dir="ltr">i forget that the code work well for small large sets <div><br></div><div>Best regards <br><br><div class="gmail_quote">On Sat, Sep 18, 2010 at 1:16 AM, Ali Habib <span dir="ltr"><<a href="mailto:ali.mahmoud.habib@gmail.com">ali.mahmoud.habib@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr"><div>Hi All,</div><div><br></div><div>I want to Read dicom data series (761 file) and surround it by VTKboxwidget but the code crash at the reading , and give the following error </div>
<div><br></div><div><br>
</div><div><b>ERROR: In m:\dev\cur\vtkdotnet\branch\50\Filtering\vtkStreamingDemandDrivenPipeline.cxx, line 628</b></div><div><b>vtkStreamingDemandDrivenPipeline (070B2110): The update extent specified in the information for output port 0 on algorithm vtkTrivialProducer(070AA4B0) is 0 1 0 1 0 1, which is outside the whole extent 0 -1 0 -1 0 -1.</b></div>
<div><b><br></b></div><div><b>ERROR: In m:\dev\cur\vtkdotnet\branch\50\Filtering\vtkImageData.cxx, line 1450</b></div><div><b>vtkImageData (070A6710): GetScalarPointer: Pixel (0, 0, 0) not in memory.</b></div><div><b> Current extent= (0, -1, 0, -1, 0, -1)</b></div>
<div><br></div><div>the code is:</div><div><br></div><div><div> vtk.vtkDICOMImageReader VDR = new vtk.vtkDICOMImageReader();</div><div> VDR.SetDirectoryName(@"E:\Master Degree\test DataSet\Asmaa_pre\08151449"); //E:\Master Degree\DataSet\case2\DICOM\PA1\ST1\SE2</div>
<div> // VDR.SetDataOrigin(0, 0, 0);</div><div> <span style="background-color:rgb(255, 255, 51)"> VDR.Update();</span></div><div><br></div><div> vtkImageData d = new vtkImageData();</div>
<div> d.DeepCopy(VDR.GetOutput());</div><div><br></div><div> int t = d.GetMaxCellSize();</div><div><br></div><div> // decrease the dataset data for large data preprocessing </div><div><br>
</div><div> vtkImageShrink3D VIS = new vtkImageShrink3D();</div><div> VIS.SetShrinkFactors(2, 2, 2);</div><div> VIS.SetInput (d);</div><div> VIS.Update();</div><div><br></div><div>
vtkImageThreshold VIT = new vtkImageThreshold();</div><div> VIT.ThresholdBetween(200, 2000);</div><div> VIT.SetInputConnection(VIS.GetOutputPort());</div><div> VIT.Update();</div>
<div><br></div><div> ///// Start the creation of volume rendering </div><div><br></div><div><br></div><div> // Render the skin - Soft tissue </div><div> double isovalue = 500;</div><div><br>
</div><div><br></div><div> vtkContourFilter skinExtractor = new vtkContourFilter();</div><div> skinExtractor.SetInputConnection(VIT.GetOutputPort());</div><div> skinExtractor.SetValue(0, isovalue);</div>
<div> skinExtractor.ComputeGradientsOn();</div><div> skinExtractor.Update();</div><div><br></div><div> gpd = new vtkPolyData();</div><div> gpd.DeepCopy(skinExtractor.GetOutput());</div>
<div><br></div><div><br></div><div> int x = gpd.GetNumberOfCells();</div><div> int y = gpd.GetNumberOfPoints();</div><div><br></div><div><br></div><div><br></div><div> vtk.vtkPolyDataMapper coneMapper = new vtk.vtkPolyDataMapper();</div>
<div> coneMapper.SetInput(gpd);</div><div> coneMapper.ScalarVisibilityOff();</div><div><br></div><div> maceActor = new vtkLODActor();</div><div> maceActor.SetMapper(coneMapper);</div>
<div> maceActor.GetProperty().SetColor(1,0,0);</div><div> //////////////////////// Selection Part /////////////////////////</div><div> planes = new vtkPlanes();</div><div><br></div><div> clipper = new vtkClipPolyData();</div>
<div> clipper.SetInput(gpd);</div><div> clipper.SetClipFunction(planes);</div><div> clipper.InsideOutOn();</div><div> clipper.Modified();</div><div> vtkPolyDataMapper selectMapper = new vtkPolyDataMapper();</div>
<div> selectMapper.SetInput(clipper.GetOutput());</div><div> selectMapper.ScalarVisibilityOff();</div><div><br></div><div> selectActor = new vtkLODActor();</div><div> selectActor.SetMapper(selectMapper);</div>
<div> selectActor.GetProperty().SetColor(0, 1, 0);</div><div> selectActor.VisibilityOff();</div><div> selectActor.SetScale(1.01, 1.01, 1.01);</div><div><br></div><div> /////////////////////// End of selection part////////////////////</div>
<div> </div><div> //////////////////////////// Cutting part /////////////////////////////////</div><div><br></div><div><br></div><div> clipper_cutting = new vtkClipPolyData();</div><div> clipper_cutting.SetInput(gpd);</div>
<div> clipper_cutting.SetClipFunction(planes);</div><div> clipper_cutting.InsideOutOff();</div><div> clipper_cutting.GenerateClippedOutputOff();</div><div> clipper_cutting.Modified();</div>
<div> vtkPolyDataMapper selectMapper_cutting = new vtkPolyDataMapper();</div><div> selectMapper_cutting.SetInput(clipper_cutting.GetOutput());</div><div> selectMapper_cutting.ScalarVisibilityOff();</div>
<div><br></div><div> selectActor_cutting = new vtkLODActor();</div><div> selectActor_cutting.SetMapper(selectMapper_cutting);</div><div> selectActor_cutting.GetProperty().SetColor(1, 0, 0);</div>
<div> selectActor_cutting.VisibilityOff();</div><div> selectActor_cutting.SetScale(1.01, 1.01, 1.01);</div><div><br></div><div> //////////////////////////// End Cutting part //////////////////////////////////////</div>
<div> vtk.vtkRenderer ren1 = new vtk.vtkRenderer();</div><div><br></div><div> renWin.AddRenderer(ren1);</div><div> //ren1.SetBackground(0.0f, 0.0f, 0.0f);</div><div><br></div><div> vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();</div>
<div> iren.SetRenderWindow(renWin);</div><div><br></div><div><br></div><div><br></div><div> //The SetInteractor method is how 3D widgets are associated with the</div><div> //render window interactor. Internally, SetInteractor sets up a bunch</div>
<div> //of callbacks using the Command/Observer mechanism (AddObserver()).</div><div> vtkBoxWidget boxWidget = new vtkBoxWidget();</div><div> boxWidget.SetInteractor(iren);</div><div> boxWidget.SetPlaceFactor(1.25);</div>
<div> boxWidget.TranslationEnabledOn();</div><div><br></div><div> </div><div> </div><div> ren1.AddActor(maceActor);</div><div> ren1.AddActor(selectActor); </div><div>
ren1.AddActor(selectActor_cutting);</div><div><br></div><div> boxWidget.SetInput(gpd);</div><div> boxWidget.Modified();</div><div> boxWidget.PlaceWidget();</div><div><br></div>
<div> boxWidget.AddObserver((uint)vtk.EventIds.StartInteractionEvent, new vtk.vtkDotNetCallback(StartInteractionEvent));</div><div> boxWidget.AddObserver((uint)vtk.EventIds.InteractionEvent, new vtk.vtkDotNetCallback(InteractionEvent));</div>
<div> boxWidget.AddObserver((uint)vtk.EventIds.EndInteractionEvent, new vtk.vtkDotNetCallback(EndInteractionEvent));</div><div> </div><div><br></div><div> boxWidget.On();</div><div><br></div>
<div><br></div><div> renWin.AddRenderer(ren1);</div><div><br></div><div> GC.Collect(); </div></div></div>
</blockquote></div><br></div></div>