public bool readNextPathFromFile(ref bool pathsAreDoubles, ref MultiSlicerInterface.LoadPathInfo info) { unsafe { if (pathsfileeof) { return(false); } info = dll.loadNextPaths(pathsfilestate.pathfile); if (dll.hasError(pathsfilestate.pathfile)) { throw new ApplicationException("Error while loading paths: " + dll.err); } if (info.numRecord < 0) { pathsfileeof = true; return(false); } pathsAreDoubles = info.saveFormat != (int)LoadPathFormat.PATHFORMAT_INT64; if (info.saveFormat == (int)LoadPathFormat.PATHFORMAT_DOUBLE_3D) { throw new ApplicationException("In file " + pathsfilename + ", record " + info.numRecord + " is a 3D Paths, but 3D Paths cannot currently be loaded"); } return(true); } }
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); }
public MultiSlicerLoader(MultiSlicerDllHandler d, string fname) { unsafe { disposed = false; pathsfilestate.pathfile = null; dll = d; pathsfilestate = dll.loadPathsFile(fname); if (pathsfilestate.pathfile == null) { throw new ApplicationException("The library could not open file " + fname); } if (dll.hasError(pathsfilestate.pathfile)) { throw new ApplicationException("Error trying to open file " + fname); } pathsfileeof = false; pathsfilename = fname; } }
public MultiSlicerHandler(MultiSlicerDllHandler d, string arguments) { dll = d; disposed = false; unsafe { state = null; state = dll.parseArguments(dll.config, arguments); if (dll.hasError(state)) { if (state != null) { dll.freeState(state); state = null; } throw new ApplicationException("Error parsing arguments for the multislicer: " + dll.err); } ParamsExtractInfo info = dll.getParamsExtract(state); numProcesses = info.numProcesses; processRadiuses = new double[numProcesses]; alsoContours = info.alsoContours != 0; usingScheduler = info.usingScheduler != 0; use_z_base = info.use_z_base != 0; if (use_z_base) { z_base = info.z_base; } if (!usingScheduler) { z_uniform_step = info.z_uniform_step; } for (int k = 0; k < numProcesses; ++k) { processRadiuses[k] = info.processRadiuses[k] * dll.factor_internal_to_input; } } }