Skip to content

Commit

Permalink
Merge pull request #47 from lassoan/master
Browse files Browse the repository at this point in the history
Fix import errors
  • Loading branch information
tashrifbillah authored Apr 27, 2022
2 parents e1e85b2 + 2040ca0 commit cc78514
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions SlicerDiffusionQC/GradQC.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import vtk, qt, ctk, slicer, mrml
from slicer.ScriptedLoadableModule import *

from gradqclib.slicerUserInteraction import slicerGUI
from diffusionqclib.nhdr_write import nhdr_write

#
# GradQC
#
Expand Down Expand Up @@ -286,7 +283,8 @@ def onSelectMask(self):


def onSelectInput(self):

from diffusionqclib.nhdr_write import nhdr_write

inPrefix= os.path.splitext(os.path.splitext(self.inputSelector.currentPath)[0])[0]
file_name= self.inputSelector.currentPath
if '.nii' in self.inputSelector.currentPath:
Expand Down Expand Up @@ -390,6 +388,8 @@ def observeStatus(caller,_):

def GUI(self):

from gradqclib.slicerUserInteraction import slicerGUI

# If in autoMode, don't call the Slicer GUI below, negative logic used for self.autoMode
if self.autoMode: # self.autoMode = True when check box checked

Expand Down
2 changes: 1 addition & 1 deletion diffusionqclib/diffusionqclib/dwi_attributes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Return headers, mri data, axis index along which gradients are listed, axialViewAxis, b-value, gradient directions
import nrrd
import numpy as np
from nhdr_write import nhdr_write
from .nhdr_write import nhdr_write
import os

def dwi_attributes(file_name, inPrefix):
Expand Down
4 changes: 2 additions & 2 deletions diffusionqclib/diffusionqclib/gradient_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
warnings.filterwarnings("ignore", category=FutureWarning)
import nibabel as nib

from dwi_attributes import dwi_attributes
from saveResults import saveResults
from .dwi_attributes import dwi_attributes
from .saveResults import saveResults

POINTS = 50 # For KDE estimation
eps = 2.2204e-16 # For preventing log( ) to be -inf
Expand Down
2 changes: 1 addition & 1 deletion diffusionqclib/diffusionqclib/nhdr_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# np.set_printoptions(precision= PRECISION, suppress= True, floatmode= 'maxprec')
np.set_printoptions(precision= PRECISION, suppress= True)

from bval_bvec_io import read_bvecs, read_bvals, bvec_scaling
from .bval_bvec_io import read_bvecs, read_bvals, bvec_scaling

def matrix_string(A):
# A= np.array(A)
Expand Down
8 changes: 4 additions & 4 deletions diffusionqclib/diffusionqclib/saveResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
warnings.filterwarnings("ignore", category=FutureWarning)
import nibabel as nib

from bval_bvec_io import read_bvals, read_bvecs, write_bvals, write_bvecs
from nhdr_write import nhdr_write
from .bval_bvec_io import read_bvals, read_bvecs, write_bvals, write_bvecs
from .nhdr_write import nhdr_write

def saveDecisions(outPrefix, deletion, confidence, bvals):

fqc = open(outPrefix+'_QC.csv', "w")
fcon = open(outPrefix+'_confidence.csv', "w")
fqc.write('Gradient #, Pass 1\Fail 0, b value\n')
fcon.write('Gradient #, Sure 1\Unsure 0, b value\n')
fqc.write('Gradient #, Pass 1/Fail 0, b value\n')
fcon.write('Gradient #, Sure 1/Unsure 0, b value\n')
for i in range(len(deletion)):
fqc.write(str(i) + ',' + str(deletion[i]) + ','+ str(bvals[i])+'\n')
fcon.write(str(i) + ',' + str(confidence[i]) + ','+ str(bvals[i])+'\n')
Expand Down

0 comments on commit cc78514

Please sign in to comment.