Commit 8071f1f1 authored by Josh's avatar Josh

changed naming scheme

parent 460f4f72
......@@ -40,8 +40,8 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
'''
Slices and segments an image and imports it into the database
'''
imgPath = pathlib.Path( imgPath ).absolute()
dbPath = pathlib.Path( dbPath ).absolute()
imgPath = pathlib.Path( imgPath )#.absolute()
dbPath = pathlib.Path( dbPath )#.absolute()
# Ensure database exists
if not dbPath.is_dir():
......@@ -70,7 +70,7 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
dbID = max( dbIDs ) + 1
# Create dir for image
baseImagePath = imagesPath.joinpath( "{}-{}-{}-Original".format( dbID, fileExt, newImgName ) )
baseImagePath = imagesPath.joinpath( "{}-{}-{}-OR".format( dbID, fileExt, newImgName ) )
baseImageName = baseImagePath.name
os.mkdir( baseImagePath )
......@@ -79,7 +79,7 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
cv2.imwrite( str( baseImageFilePath ), imgArr )
# Create dir for sliced images
slicedImagePath = baseImagePath.joinpath( "Sliced" )
slicedImagePath = baseImagePath.joinpath( "SL" )
os.mkdir( slicedImagePath )
# Run processing
......@@ -102,7 +102,7 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
y = sliceList[i][1]
sliceArr = sliceList[i][2]
sliceBaseName = "{}-{}-{}-{}-Sliced".format( baseImageName, size, x, y )
sliceBaseName = "{}-{}-{}-{}-SL".format( baseImageName, size, x, y )
sliceBasePath = slicedSizePath.joinpath( sliceBaseName )
os.mkdir( sliceBasePath )
......@@ -111,7 +111,7 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
cv2.imwrite( str( sliceFilePath ), sliceArr )
# Create Processed Slice Path
sliceProcPath = sliceBasePath.joinpath( "Processed" )
sliceProcPath = sliceBasePath.joinpath( "PROC" )
os.mkdir( sliceProcPath )
# Segmented image and label image
......@@ -119,18 +119,18 @@ def importAndProcess( imgPath: str, dbPath: str, newImgName: str ):
msLabImg = processedList[i][4]
msSegDir = sliceProcPath.joinpath( "{}-{}-{}".format( sliceBaseName,
"MeanShiftSegmentation",
"Processed" ) )
"MSSEG",
"PROC" ) )
msSegFileDir = msSegDir.joinpath( "{}.{}".format( msSegDir.name, fileExt ) )
msLabFileDir = msSegDir.joinpath( "{}-{}-{}".format( sliceBaseName,
"MeanShiftLabels",
"Processed" ) )
"MSLAB",
"PROC" ) )
#msLabFileDir = msLabDir.joinpath( "{}".format( msLabDir.name ) )
os.mkdir( msSegDir )
#os.mkdir( msLabDir )
# Save processed image and label array
cv2.imwrite( str( msSegFileDir ), msSegArr )
cv2.imwrite( str( msSegFileDir ), msSegArr )
np.save( str( msLabFileDir ), msLabImg )
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment