Skip to content

Commit

Permalink
fix a minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
idhamari committed Nov 18, 2023
1 parent 1e7fbe6 commit 5c58e2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
13 changes: 7 additions & 6 deletions VisSimCommon/VisSimCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,12 @@ def t2v(self,txt):
# This function convert an IJK point to RAS point
# input: a point vector and volume node
# output: a point vector
def ptIJK2RAS(self,ptIJK,inputImg): # imgPath or imgNode are supported
def ptIJK2RAS(self,ptIJK, inputImg): # imgPath or imgNode are supported
#TODO: add option for printing
# create a IJK2RAs transformation matrix
inputImgNode =inputImg
if (isinstance(inputImg, str)):
inputImgNode = slicer.util.loadVolume( inputImg, returnNode=True)

inputImgNode = slicer.util.loadVolume( inputImg)
ijk2rasM = vtk.vtkMatrix4x4()
inputImgNode.GetIJKToRASMatrix(ijk2rasM)
ptRAS=np.zeros((len(ptIJK),3))
Expand Down Expand Up @@ -469,13 +468,13 @@ def runCropping(self, inputVolume, pointT,croppingLengthT, samplingLengthT, hrCh
#TODO: Get Slicer PATH
SlicerPath = os.path.abspath(os.path.join(os.path.abspath(os.path.join(os.sys.executable, os.pardir)), os.pardir))
SlicerBinPath = os.path.join(SlicerPath,"Slicer")
ResampleBinPath = os.path.join(SlicerPath,"lib","Slicer-4.11" , "cli-modules","ResampleScalarVolume" )
ResampleBinPath = os.path.join(SlicerPath,"lib","Slicer-5.4" , "cli-modules","ResampleScalarVolume" )
if sys.platform == 'win32':
ResampleBinPath + ".exe"
resamplingCommand = SlicerBinPath + " --launch " + ResampleBinPath
else:
#note: in windows, no need to use --launch
resamplingCommand = ResampleBinPath + ".exe"
resamplingCommand = ResampleBinPath

print(resamplingCommand)
si = None
Expand Down Expand Up @@ -969,7 +968,9 @@ def getItemInfo(self, segNode, masterNode, tblNode, vtID):
if (vtID ==7) and (self.vtVars['vtMethodID']== "0"): # for testing
print("updating COM in table ..............")
segID = segNode.GetSegmentation().GetSegmentIdBySegmentName("C"+str(vtID))
modelNode = segNode.GetClosedSurfaceRepresentation(segID)
#modelNode = segNode.GetClosedSurfaceRepresentation(segID)
modelNode = segNode.GetClosedSurfaceInternalRepresentation(segID)

com = vtk.vtkCenterOfMass(); com.SetInputData(modelNode); com.Update()
segNodeCoM = com.GetCenter()
tblNode.SetCellText(idx,2,str(segNodeCoM[0]))
Expand Down
17 changes: 0 additions & 17 deletions link2MeWin.BAT

This file was deleted.

0 comments on commit 5c58e2b

Please sign in to comment.