Aug-25-2017, 04:18 PM
Hello,
I am new to python and I have a novice question. Here is my code:
############Code Begin#############
import dicom
import os
import numpy
from matplotlib import pyplot, cm
fwd_hd = dicom.read_file("fwd_abcd/i00001.CFMRI.1")
rvs_hd = dicom.read_file("rvs_abcd/i00001.CFMRI.1")
parameters = "Rows", "Columns", "IDSeriesTime"
for parameter in parameters:
varfwd = "fwd_hd.%s" % parameter
varrvs = "rvs_hd.%s" % parameter
if varfwd != varrvs:
print("forward and reverse variable %s DOES NOT MATCH!!!") % parameter
############Code End#############
fwd_hd.Columns = 90
rvs_hd.Columns = 60
I want to compare varfwd and varrvs, but not the string 'fwd_hd.Columns' and 'rvs_hd.Columns'...
Which is what this code does.
I want to compare the value of the variable fwd_hd.Columns and rvs_hd.Columns.
Can anyone help me figure out what I have done wrong? I have tried for several hours to solve it.
Thanks a lot!
I am new to python and I have a novice question. Here is my code:
############Code Begin#############
import dicom
import os
import numpy
from matplotlib import pyplot, cm
fwd_hd = dicom.read_file("fwd_abcd/i00001.CFMRI.1")
rvs_hd = dicom.read_file("rvs_abcd/i00001.CFMRI.1")
parameters = "Rows", "Columns", "IDSeriesTime"
for parameter in parameters:
varfwd = "fwd_hd.%s" % parameter
varrvs = "rvs_hd.%s" % parameter
if varfwd != varrvs:
print("forward and reverse variable %s DOES NOT MATCH!!!") % parameter
############Code End#############
fwd_hd.Columns = 90
rvs_hd.Columns = 60
I want to compare varfwd and varrvs, but not the string 'fwd_hd.Columns' and 'rvs_hd.Columns'...
Which is what this code does.
I want to compare the value of the variable fwd_hd.Columns and rvs_hd.Columns.
Can anyone help me figure out what I have done wrong? I have tried for several hours to solve it.
Thanks a lot!