Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions cvasl/seperated.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,3 +1157,49 @@ def preprocess(
read.to_csv(read_name)
read_names.append(read_name)
return read_names


def deal_with_readout_and_labelling(dataframes_list, droppies):
"""
This function takes a list of asl containing dataframes
of extracted MRI parameters and converts some of the ASL
parameters to numerical values so they can be used for
machine learning.


:param dataframes_list: list of dataframes
:type dataframes_list: list
:param droppies: list of columns to drop
:type droppies: list


:returns: list of dataframes transformed
:rtype: list
"""
new_frames = []
for frame in dataframes_list:
if 'M0' in frame.columns:
frame.M0 = frame.M0.replace(to_replace=['No', 'Yes'], value=[1, 2])
if 'm0' in frame.columns:
frame.m0 = frame.m0.replace(to_replace=['No', 'Yes'], value=[1, 2])
if 'Readout' in frame.columns:
frame.Readout = frame.Readout.replace(
to_replace=['3DSpiral', '2DEPI', '3DGRASE'],
value=[1, 2, 3]
)
frame.Labelling = frame.Labelling.replace(
to_replace=['PCASL', 'PASL'],
value=[1, 2]
)
if 'readout' in frame.columns:
frame.readout = frame.readout.replace(
to_replace=['3DSpiral', '2DEPI', '3DGRASE'],
value=[1, 2, 3]
)
frame.labelling = frame.labelling.replace(
to_replace=['PCASL', 'PASL'],
value=[1, 2]
)
frame = frame.drop(droppies, axis=1)
new_frames.append(frame)
return new_frames
Loading