Skip to content

Commit 43b8d87

Browse files
committed
Filter anat suffix during load
1 parent fb22681 commit 43b8d87

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/rbc/bids/session.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import polars as pl
1212

1313
from rbc.bids import extract_entities
14+
from rbc.bids._schema import Datatype, Suffix
1415

1516
if TYPE_CHECKING:
1617
from collections.abc import Iterator, Sequence
@@ -50,8 +51,12 @@ def load_session(df: pl.DataFrame, subject: str, session: str | None) -> Session
5051
base: list[pl.Expr] = [pl.col("sub") == subject]
5152
if session is not None:
5253
base.append(pl.col("ses") == session)
53-
anat_df = df.filter(pl.all_horizontal([*base, pl.col("datatype") == "anat"]))
54-
func_df = df.filter(pl.all_horizontal([*base, pl.col("datatype") == "func"]))
54+
anat_df = df.filter(
55+
pl.all_horizontal(
56+
[*base, pl.col("datatype") == Datatype.ANAT, pl.col("suffix") == Suffix.T1W]
57+
)
58+
)
59+
func_df = df.filter(pl.all_horizontal([*base, pl.col("datatype") == Datatype.FUNC]))
5560

5661
return SessionTables(anat=anat_df, func=func_df if not func_df.is_empty() else None)
5762

0 commit comments

Comments
 (0)