[vtkusers] vtkDICOMImageReader limits

Ali Habib ali.mahmoud.habib at gmail.com
Sun Sep 5 15:15:12 EDT 2010


I solved the proplem of memory an vtkDicomImagereader  but the piple crash
when placewidget call

the code is :
                /* vtk.vtkSphereSource cone = new vtk.vtkSphereSource();
                 cone.SetRadius(1.0f);*/

                vtk.vtkDICOMImageReader VDR = new vtk.vtkDICOMImageReader();
                VDR.SetDirectoryName(@"G:\Master Degree\test DataSet\My
Disc\07291640");
                VDR.SetDataOrigin(0, 0, 0);
                VDR.Modified();

                // decrease the dataset data for large data preprocessing

                vtkImageShrink3D VIS = new vtkImageShrink3D();
                VIS.SetShrinkFactors(2, 2, 2);
                VIS.SetInputConnection(VDR.GetOutputPort());
                VIS.Modified();

                 vtkImageThreshold VIT = new vtkImageThreshold();
                VIT.ThresholdBetween(200, 2000);
                VIT.SetInputConnection(VIS.GetOutputPort());
                VIT.Modified();

                ///// Start the creation of volume rendering

                //1. Gget the range of data
                vtk.vtkImageChangeInformation VIC = new
vtk.vtkImageChangeInformation();
                VIC.SetInput(VIT.GetOutput());
                VIC.CenterImageOn();
                VIC.Modified();

                vtk.vtkImageData VoxelData = new vtk.vtkImageData();
                VoxelData = VIC.GetOutput();

                double[] metaScalarRange = VoxelData.GetScalarRange();


                // Render the skin - Soft tissue
                double isovalue = 0.8 * (metaScalarRange[1] +
metaScalarRange[0]);


                vtkContourFilter skinExtractor = new vtkContourFilter();
                skinExtractor.SetInputConnection(VIT.GetOutputPort());
                skinExtractor.SetValue(0, isovalue);
                skinExtractor.ComputeGradientsOn();
                skinExtractor.Modified();


                gpd = skinExtractor.GetOutput();

                vtk.vtkPolyDataMapper coneMapper = new
vtk.vtkPolyDataMapper();
                coneMapper.SetInput(gpd);
                coneMapper.ScalarVisibilityOff();

                maceActor = new vtkLODActor();
                maceActor.SetMapper(coneMapper);
                maceActor.GetProperty().SetColor(1, 0, 0);
                //////////////////////// Selection Part
/////////////////////////
                planes = new vtkPlanes();

                clipper = new vtkClipPolyData();
                clipper.SetInput(gpd);
                clipper.SetClipFunction(planes);
                clipper.InsideOutOn();
                clipper.Modified();
                vtkPolyDataMapper selectMapper = new vtkPolyDataMapper();
                selectMapper.SetInput(clipper.GetOutput());
                selectMapper.ScalarVisibilityOff();
                selectMapper.Modified();
                selectActor = new vtkLODActor();
                selectActor.SetMapper(selectMapper);
                selectActor.GetProperty().SetColor(0, 1, 0);
                selectActor.VisibilityOff();
                selectActor.SetScale(1.01, 1.01, 1.01);
                selectActor.Modified();
                /////////////////////// End of selection
part////////////////////

                //////////////////////////// Cutting part
/////////////////////////////////


                clipper_cutting = new vtkClipPolyData();
                clipper_cutting.SetInput(gpd);
                clipper_cutting.SetClipFunction(planes);
                clipper_cutting.InsideOutOff();
                clipper_cutting.GenerateClippedOutputOff();
                clipper_cutting.Modified();
                vtkPolyDataMapper selectMapper_cutting = new
vtkPolyDataMapper();
                selectMapper_cutting.SetInput(clipper_cutting.GetOutput());
                selectMapper_cutting.ScalarVisibilityOff();
                selectMapper_cutting.Modified();
                selectActor_cutting = new vtkLODActor();
                selectActor_cutting.SetMapper(selectMapper_cutting);
                selectActor_cutting.GetProperty().SetColor(1, 0, 0);
                selectActor_cutting.VisibilityOff();
                selectActor_cutting.SetScale(1.01, 1.01, 1.01);
                selectActor_cutting.Modified();

                //////////////////////////// End Cutting part
//////////////////////////////////////
                vtk.vtkRenderer ren1 = new vtk.vtkRenderer();
                ren1.Modified();
                renWin.AddRenderer(ren1);
                //ren1.SetBackground(0.0f, 0.0f, 0.0f);

                vtkRenderWindowInteractor iren = new
vtkRenderWindowInteractor();
                iren.SetRenderWindow(renWin);



                //The SetInteractor method is how 3D widgets are associated
with the
                //render window interactor.  Internally, SetInteractor sets
up a bunch
                //of callbacks using the Command/Observer mechanism
(AddObserver()).
                vtkBoxWidget boxWidget = new vtkBoxWidget();
                boxWidget.SetInteractor(iren);
               boxWidget.SetPlaceFactor(1.25);
                boxWidget.TranslationEnabledOn();



                ren1.AddActor(maceActor);
                ren1.AddActor(selectActor);
                ren1.AddActor(selectActor_cutting);

                boxWidget.SetInput(gpd);
                boxWidget.Modified();  // crash here
                boxWidget.PlaceWidget();


 boxWidget.AddObserver((uint)vtk.EventIds.StartInteractionEvent, new
vtk.vtkDotNetCallback(StartInteractionEvent));
                boxWidget.AddObserver((uint)vtk.EventIds.InteractionEvent,
new vtk.vtkDotNetCallback(InteractionEvent));

 boxWidget.AddObserver((uint)vtk.EventIds.EndInteractionEvent, new
vtk.vtkDotNetCallback(EndInteractionEvent));


                boxWidget.On();

                renWin.AddRenderer(ren1); renWin.Modified();

any suggestion please

On Sun, Sep 5, 2010 at 12:01 AM, Darshan Pai <darshanpai at gmail.com> wrote:

> I have been using DICOMReader in 64 bit OS and it has not crashed on me
> before . Probably its a memory error . I usually convert it into Analyze
> format and reduce the dimensions or the data type so that it can be loaded .
> Maybe you can try that .
>
> Regards
> Darshan
>
> On Fri, Sep 3, 2010 at 5:44 PM, Ali Habib <ali.mahmoud.habib at gmail.com>wrote:
>
>> it's 245 MB data , I will search for that I use c# and vista as operating
>> system
>>
>>
>> On Sat, Sep 4, 2010 at 12:32 AM, John Drescher <drescherjm at gmail.com>wrote:
>>
>>> On Fri, Sep 3, 2010 at 5:28 PM, John Drescher <drescherjm at gmail.com>
>>> wrote:
>>> >> I successfully read DICOM data using  vtkDICOMImageReader   for
>>> directory
>>> >> contains 78  files
>>> >> But when tried to load from directory contains 418 files , my
>>> application
>>> >> crashed
>>> >>             vtk.vtkDICOMImageReader VDR = new
>>> vtk.vtkDICOMImageReader();
>>> >>             VDR.SetDirectoryName(@"G:\Master Degree\test DataSet\My
>>> >> Disc\07291640");
>>> >>             VDR.SetDataOrigin(0, 0, 0);
>>> >>             VDR.Modified();
>>> >> any suggestion please , or is there any
>>> limits regarding vtkDICOMImageReader
>>> >
>>> > I believe it is limited to around 4GB dicom files since the reader
>>> > uses 32 bit index pointers.
>>> >
>>>
>>> In 32bit windows however you will be limited by the largest
>>> allocatable memory block which should be around 1.2GB ( even if your
>>> PC has 4 GB of ram) unless you have your program compiled with the
>>> LARGEADDRESSAWARE linker flag and you have your OS set to allow 3GB
>>> applications.
>>>
>>> John
>>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100905/98be6f4b/attachment.htm>


More information about the vtkusers mailing list