Exemple #1
0
        //2d simple multislicing
        private unsafe void multislice_2dsimple(SI.ExternalSlicerManager external, SI.MultiSlicerHandler handler, bool alsoContours, Transaction tr, BlockTableRecord btr)
        {
            double zstep = handler.z_uniform_step;

            double[] zs = handler.use_z_base ? external.prepareSTLSimple(zstep, handler.z_base) :
                          external.prepareSTLSimple(zstep);
            int numslices = zs.Length;

            for (int i = 0; i < numslices; ++i)
            {
                SI.IntPoint[][] rawslice = external.readSlice();
                if (rawslice.Length == 0)
                {
                    continue;
                }
                if (alsoContours)
                {
                    showExternalSlice(rawslice, external.scalingFactor, zs[i], tr, btr);
                }
                void *slice = handler.feedRawSliceIntoDll(rawslice);
                rawslice = null;
                void *result = handler.computeSlice2D(slice); //the slice is freed in computeSlice2D()
                if (result == null)
                {
                    throw new ApplicationException("Error in compute2D: " + dll.err);
                }
                try {
                    const bool mode2D = true;
                    int        ntools = handler.numProcesses;
                    for (int j = 0; j < ntools; ++j)
                    {
                        readOutputSlices(result, mode2D, alsoContours, zs[i], j, tr, btr);
                    }
                } finally {
                    if (result != null)
                    {
                        dll.freeResult(result);
                    }
                }
            }
        }
Exemple #2
0
        public unsafe void *computeSlice2D(void *slice)
        {
            void *result = null;

            try {
                result = dll.computeResult(slice, state);
                if (dll.hasError(result))
                {
                    dll.freeInputSlice(slice);
                    slice = null;
                    if (result != null)
                    {
                        dll.freeResult(result);
                    }
                    return(null);
                }
            } finally {
                if (slice != null)
                {
                    dll.freeInputSlice(slice);
                }
            }
            return(result);
        }