API Reference
This section contains the complete API reference for Ngawari. The library is organized into three main modules:
Core Modules
- ftk - Mathematical and Utility Functions
getIDOfClosestFloat()getClosestFloat()getIDOfClosestPoint()getClosestPoint()distPointPoints()squareDistPointPoints()sortedIDsOfClosestPoints()distTwoPoints()getIDsOfClosestPoints()getIDsOfFartherestPoints()vectorMagnitudes()normaliseArray()angleBetween2Vec()angleBetweenVecAndPlane()areVecsMatching()linearFit()fitPlaneToPoints()polyfit2d()polyval2d()projectPtsToPlane()project3DPointsToPlanarCoordinateSystem()project3DPointsToPlanarCoordinateSystem_OLD()project3DPointsToPlanarCoordinateSystem2()convert2DPointsTo3DCoordinateSystem()fitCircle2D()fitCircleRANSAC()fitCircleRANSAC3D_xyz()fit_ellipse_2d()fit_ellipse_3d()buildCircle3D()fitPlaneToPointCloud_RANSAC()linerFit_RANSAC()deg2rad()rad2deg()rotateArray()rotationMatrixFromThreeAngles()getClosestInSortedList()getIdOfClosestFloat()polar2Cart()polar2z()z2Polar()cart2Polar()unit_vector()vecFromPtToLine()fcdot()cosineDifferenceBetweenTwoMats()getVectorComponentAlongRefVec()getVectorComponentAlongRefVec_Mag()getVectorComponentNormalToRefVec()closeCurve()splinePoints()splineFunction()splineXY()splineCurve()getMaxsMinsInflections()sigmoidFunction()extractContinuousSegFromPeriodic()fitGaussianToData()gaussianFunction()calculate_signed_area_2d()isClosedPolygonClockwise()ensureClosedPolyIsClockwise()setFirstPtOfPolygon()reorderPointsStartClosestToX()reorderPointsStatingAti()sortPointsByClosest_RETURNIDs()sortPointsByClosest()cumulativeDistanceAlongLine()getIdOfPointClosestToX()getPolygonMeanRadius()getPolygonMeanDiameter()getPolygonCenterPoint()lineMagnitude()distancePointToLineSegPerpendicular()ndarrayToListOfTuple3()diff()circleFit2DErr()distanceToPlane()residualPlane()residualsCircle()icp()fitPlane3DOptimize()fitCircle3D()lagBetweenTwoCurves()calculatePlaneThreePoints()getPlaneConstantsFromPointAndVector()calculateDerivativeOnLine_backwardDiff()calculateSecondDerivativeOnLine()calculateCurvature3Pts()calculateCurvature_D()setVectorDirection()buildRotationMatrix()adjustPointsCenterOfMassToOrigin()areVecsConsistent()setVecAConsitentWithVecB()buildConvexHUll3D()orderPointsConvexHull_IDs()orderPointsConvexHull()groupContinuousLinesByTol()buildContinuousLineByClosestPt()accumulatedAverage()interpolateNANsFromSurroundingValues_cubic()doesLineSegPierceTriangle()doesLinePierceTriangle()pluckerSideOperator()pluckerLine()doesVectorPierceAnyTriangle()calculateBSA()interpolateNANsFromSurroundingValues_linear()convexHull()- Vector Operations
- Matrix Operations
- Geometric Calculations
- Point and Line Utilities
- Mathematical Transformations
- fIO - File Input/Output
remove_symbols()remove_not_allowed()countFilesInDir()getAllFilesUnderDir()parseFileToTagsDictionary()writeDictionaryToFile()NumpyEncoderwriteDictionaryToJSON()parseJsonToDictionary()strListToFloatList()xmlIndent()findAndReplaceTextInFile()readFileToListOfLines()appendFiles()pickleData()unpickleData()tarGZLocal_AndMove()addSuffixToName()checkIfExtnPresent()readDataCSV()writeCSVFile()detectDelimiter()writePlyFile()writeVTKFile()readVTKFile()nii_to_niigz()writeNifti()readNifti()readNRRD()writeVTK_PVD_Dict()pvdAddTimeToFieldData()writeZipFromVTK_PVD_Dict()deleteFilesByPVD()readPVDFileName()readImageFileToDict()readPVD()pvdGetDict()pvdGetClosestTimeToT()pvdGetTimes()pvdGetIdOfT()pvdGetFileAtT()pvdGetNumberTimePoints()pvdGetDataFileRoot_Prefix_and_Ext()pvdGetDataClosestTo()pvdMultiply()pvdReverse()pvdRestart_t()pvdRestart()pvdClip()pvdResetTimes()pvdResetStartPoint_Id()pvdResetStartPoint()pvdAddStartPointAtEndForPeriodicy()buildPVD_WaterFallRestarts()- VTK File Formats
- Other File Formats
- PVD File Operations
- Data Conversion
- Batch Processing
- vtkfilters - VTK Filtering and Processing
isVTI()isVTP()isVTS()angleBetweenTwoVectors()getArrayNames()getArray()getScalarsArrayName()getVectorsArrayName()getArrayId()renameArray()getArrayAsNumpy()getScalarsAsNumpy()setArrayFromNumpy()addNpArray()setArrayDtype()setArrayAsScalars()setArrayAsVectors()ensureScalarsSet()delArray()delArraysExcept()addFieldData()getFieldData()getFieldDataDict()getFieldDataNames()duplicateFieldData()deleteFieldData()getVtkPointsAsNumpy()getPtsAsNumpy()getCellCenters()buildImplicitSphere()buildSphereSource()buildCylinderSource()buildImplicitBox()buildCubeSource()buildPolyLineBetweenTwoPoints()buildPolyTrianglesAtCp()buildPlaneCentredOnRoi()buildPlaneCentredOnSphere()buildPlanePtAndNorm()buildPlaneCentredOnO()buildPlaneSource()buildPolyLineFromXYZ_spline()buildPolyLineFromXYZ()buildPolydataFromXYZ()clippedByCircle()sliceByPlane()getDataCutByPlane()getPolyDataClippedByROI()getPolyDataClippedByBox()getPolyDataClippedBySphere()clippedByPolyData()doesLinePierceTri()doesLinePiercePolygon()clippedByPlane()clipDataByPlane()clippedByPlaneClosedSurface()clippedBySphere()clippedByScalar()clipVolumeToEightPolydataBoxes()roi_line_to_roi_plane()clipPlaneToROI()vtiToVts()vtsToVti()getVtsOrigin()getVtsDirectionVectors()getVtsResolution()getResolution_VTI()resetIndexing()resetVTSIndexing()resetVTIIndexing()getDimsResOriginFromOutline()buildRawImageDataFromPolyData()buildRawImageDataFromOutline()buildRawImageDataFromOutline_dims()duplicateImageData()buildRawImageData()surf2ImageBW()getVarValueAtI_ImageData()getImageX()imageX_ToStructuredCoords()imageIndex_ToStructuredCoords()getNeighbours26_fromImageIndex()imageStrucCoords_toIndex()imageStrucCoords_toX()filterFlipImageData()getPolyDataMeanFromCenter()copyPolyData()copyData()contourFilter()cleanData()reduceNumberOfPoints()filterBoolean()tubeFilter()filterVtpSpline()filterTransformPolyData()translatePoly_AxisA_To_AxisB()transformPolydataA_to_B_ICP()iterativeClosestPointsTransform()filterWarpPolydataByVectors()transformImageData()pointToCellData()cellToPointData()getOutline()getMaximumBounds()appendPolyData()appendPolyDataList()appendImageList()appendUnstructured()mergeTwoImageData()multiblockToList()idListToVtkIDs()extractCells()extractSelection()delCellsByEdgeLength()delCellsByID()getPolylineLength()getLoopSubDivided()decimateTris()shrinkWrapData()poissonRecon()pointCloudRemoveOutliers()smoothTris()smoothTris_SINC()filterExtractEdges()isPolyDataWaterTight()isPolyDataPolyLine()calculatePolyDataArea()getPolyDataCenterPtNormal()addMagnitudeArray()addNormalVelocities()filterDilateErode()filterExtractSurface()filterExtractTri()filterTriangulate()getVolumeSurfaceAreaOfPolyData()mergeSurfsByPointsInsideVti()getTriangleAreaAndNormal()addNormalsToPolyData()getBoundaryEdges()getEdges()getConnectedCellIds()extractStructuredSubGrid()extractVOI()extractVOI_fromFov()filterNullOutsideSurface()filterNullInsideSurface()filterResampleToDataset()filterResampleToImage()getTransposeIDS_and_FlipIDs_VTS2VTI()filterResampleToImage_BestAligned()getAxesDirectionCosinesForNormal()filterResliceImage()filterGaussianSmooth()filterVtiMedian()filterImageGradient()filterAnisotropicDiffusion()filterSurfaceToImageStencil()filterMaskImageBySurface()filterGetPointsInsideSurface()filterGetPointIDsInsideSurface()filterGetPolydataInsideSurface()filterGetEnclosedPts()filterGetArrayValuesWithinSurface()getDataWithThreshold()countPointsInVti()getConnectedRegionLargest()getConnectedRegionContaining()getConnectedRegionClosestToX()getConnectedRegionClosestToX_UnStruct()getConnectedRegionAll()getConnectedRegionMinDistToX()- Data Type Checkers
- Array Operations
- Geometry Creation
- Filtering Operations
- Clipping and Cutting
- Image Data Operations
- Surface Operations
- Data Conversion
- Utility Functions
Module Overview
ftk - Mathematical and Utility Functions
The ftk module provides mathematical utilities and helper functions for working with vectors, matrices, and geometric operations.
Key features: * Vector and matrix operations * Geometric calculations * Point and line utilities * Mathematical transformations
fIO - File Input/Output
The fIO module handles reading and writing VTK file formats and other data formats.
Key features: * VTK file format support (VTP, VTI, VTS, VTU) * Other format support (STL, OBJ, PLY) * Data conversion utilities * Batch processing capabilities
vtkfilters - VTK Filtering and Processing
The vtkfilters module provides comprehensive VTK filtering and processing operations.
Key features: * VTK data object utilities * Array management and conversion * Geometry creation and manipulation * Clipping and cutting operations * Surface and volume processing * Connected region analysis
Usage Examples
Basic Import
import ngawari as ng
# Or import specific modules
from ngawari import ftk, fIO, vtkfilters
Common Patterns
# Load data
data = ng.loadVTP("mesh.vtp")
# Process data
processed = ng.smoothTris(data, iterations=10)
# Save result
ng.saveVTP(processed, "smoothed_mesh.vtp")
For detailed information about each module, click on the links above or use the navigation menu.